import java.applet.*; import java.awt.*; public class TipOfDay extends Applet { Dialog d; public TipOfDay() { } public String getAppletInfo() { return "Name: TipOfDay\r\n" + "Author: Brian Jahns\r\n" + "Created with Microsoft Visual J++ Version 1.1"; } public void init() { Frame f=new Frame(); d=new NewDialog(f,"Tip of the day",false); d.setLayout(new GridLayout(2,2,10,10)); d.add(new Label("Dont't bet on the races!")); d.add(new Button("OK")); d.add(new Label("You'll Probably Lose.")); d.add(new Button("CANCEL")); d.resize(300,100); d.show(); } public void destroy() { } public void paint(Graphics g) { } public void start() { } public void stop() { } } // // //NewDialog // // class NewDialog extends Dialog { NewDialog(Frame f, String title, boolean m) { super(f, title, m); } public boolean action(Event evt, Object arg) { if(evt.target instanceof Button) { String label=(String)arg; if(label.equals("OK")) this.dispose(); if(label.equals("CANCEL")) this.dispose(); return true; } else return false; } public boolean handleEvent(Event evt) { if(evt.id==Event.WINDOW_DESTROY) { dispose(); return true; } else { super.handleEvent(evt); return true; } } }