qse/ase/test/awk/AwkApplet.java

64 lines
1.1 KiB
Java
Raw Normal View History

2007-03-23 07:45:22 +00:00
//package ase.test.awk;
2006-11-26 16:17:51 +00:00
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
2007-03-23 07:45:22 +00:00
import java.net.URL;
2007-01-25 14:14:56 +00:00
2006-11-26 16:17:51 +00:00
public class AwkApplet extends Applet
{
public void init ()
{
Button btn_run;
btn_run = new Button ("Run Awk");
btn_run.addActionListener (new ActionListener ()
{
public void actionPerformed (ActionEvent e)
{
run_awk ();
}
});
add (btn_run);
}
public void stop () {}
public void paint (Graphics g) {}
private void run_awk ()
{
2007-03-23 07:45:22 +00:00
ase.test.awk.Awk awk = null;
2006-11-26 16:17:51 +00:00
try
{
2007-03-23 07:45:22 +00:00
/*
URL url = ase.awk.Awk.class.getResource ("aseawk_jni.dll");
if (url == null) url = ase.awk.Awk.class.getResource ("aseawk_jni.so");
if (url != null) System.load (url.getFile()); */
try
{
System.load ("c:/projects/ase/test/awk/aseawk_jni.dll");
}
catch (Exception e)
{
System.err.println ("fuck you");
}
awk = new ase.test.awk.Awk ();
2006-11-26 16:17:51 +00:00
awk.parse ();
awk.run ();
}
catch (ase.awk.Exception e)
{
System.out.println ("ase.awk.Exception - " + e.getMessage());
}
finally
{
if (awk != null) awk.close ();
}
}
}