import java.awt.*; import java.applet.Applet; public class Nimedialoog1 extends Dialog{ Button nupp=new Button("OK"); TextField tekst; Label teade; Applet apl; public Nimedialoog1(String katus, Applet ap) { super(new Frame(), katus, true); resize(400, 100); move(320,140); Panel p1 = new Panel(); p1.setLayout(new FlowLayout()); p1.add(teade=new Label("Your name: ")); p1.add(tekst=new TextField(20)); p1.add(nupp); add("Center", p1); apl=ap; } public boolean action(Event e, Object o) { System.out.println("Pihtas"); if (tekst.getText().length()>1) { dispose(); apl.action(e, tekst.getText()); return true; } return super.action(e, o); } /* public boolean lostFocus(Event e, Object arg){ if(e.target==tekst)nupp.requestFocus(); else tekst.requestFocus(); return true; } */ }