import java.applet.*; import java.awt.*; public class FrameLocation extends Applet { Frame frame; Button button; public void init() { button = new Button("Report frame location"); add(button); frame = new Frame("A frame"); frame.reshape(100, 100, 300, 300); frame.validate(); frame.show(); } public void paint(Graphics g) { g.drawString("Frame x = " + frame.location().x, 10 , 100); g.drawString("Frame y = " + frame.location().y, 10 , 125); } public final boolean action(Event evt, Object obj) { if (evt.target == button) { System.out.println("Frame x = " + frame.location().x); System.out.println("Frame y = " + frame.location().y); repaint(); } return super.action(evt, obj); } } // END OF Class FrameLocation