home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-02-16 | 845 b | 36 lines |
- import java.awt.*;
- import java.applet.*;
- import MyClass;
-
- public class Applet19 extends Applet
- {
- MyClass myObject;
- TextField textField1;
-
- public void init()
- {
- myObject = new MyClass(1);
- textField1 = new TextField(10);
- add(textField1);
- textField1.setText("1");
- }
-
- public void paint(Graphics g)
- {
- String s = textField1.getText();
- int value = Integer.parseInt(s);
- myObject.SetField(value);
- value = myObject.GetField();
- s = String.valueOf(value);
- g.drawString("The data field of the object", 30, 80);
- g.drawString("is now set to this value:", 40, 95);
- g.drawString(s, 90, 125);
- }
-
- public boolean action(Event event, Object arg)
- {
- repaint();
- return true;
- }
- }
-