Reformatteda all source using eclipse eliminated parameters with same names as method variagles repackaged all tests so that their package names match the directories they are in merged in Jiffie and Variant EventProxy changes
50 lines
1017 B
Java
50 lines
1017 B
Java
package samples.applet;
|
|
|
|
import java.awt.*;
|
|
import java.awt.event.*;
|
|
import java.applet.*;
|
|
|
|
import com.jacob.com.*;
|
|
import com.jacob.activeX.*;
|
|
|
|
/**
|
|
* Applet test case
|
|
*/
|
|
public class AppTest extends Applet implements ActionListener
|
|
{
|
|
TextField in;
|
|
TextField out;
|
|
Button calc;
|
|
ActiveXComponent sC = null;
|
|
Object sControl = null;
|
|
|
|
/**
|
|
* startup method
|
|
*/
|
|
public void init()
|
|
{
|
|
setLayout(new FlowLayout());
|
|
add(in = new TextField("1+1", 16));
|
|
add(out = new TextField("?", 16));
|
|
add(calc = new Button("Calculate"));
|
|
calc.addActionListener(this);
|
|
|
|
}
|
|
|
|
/**
|
|
* action method that receives button actions
|
|
* @param ev the event
|
|
*/
|
|
public void actionPerformed(ActionEvent ev)
|
|
{
|
|
if (sC == null) {
|
|
String lang = "VBScript";
|
|
sC = new ActiveXComponent("ScriptControl");
|
|
sControl = sC.getObject();
|
|
Dispatch.put(sControl, "Language", lang);
|
|
}
|
|
Variant v = Dispatch.call(sControl, "Eval", in.getText());
|
|
out.setText(v.toString());
|
|
}
|
|
}
|