import java.applet.*; import java.awt.*; import java.awt.event.*; public class brush_back extends Applet implements WindowListener { Frame frame; Label label; public void init() { frame = new Frame("A frame"); frame.setLayout(new GridBagLayout()); frame.setBounds(100, 100, 600, 300); frame.setBackground(Color.yellow); label = new Label("Some random label"); frame.add(label); frame.validate(); frame.show(); frame.addWindowListener(this); } public void windowOpened(WindowEvent we){} public void windowClosed(WindowEvent we){} public void windowIconified(WindowEvent we){} public void windowDeiconified(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowClosing(WindowEvent we) { if (we.getSource() == frame) { frame.setVisible(false); frame.dispose(); } } public void paint(Graphics g) { g.drawString("A frame should pop up", 10 , 20); } } // END OF Class brush_back