import java.awt.Insets; import javax.swing.JFrame; public class NewFrame {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(500, 500);
frame.setVisible(true); Insets insets = frame.getInsets();
System.out.println(insets.top);
System.out.println(insets.bottom);
System.out.println(insets.left);
System.out.println(insets.right);
}
}
import java.awt.Insets; import javax.swing.JFrame; public class NewFrame extends JFrame { public void launchFrame() {
this.setSize(500, 500);
this.setLocation(300, 300);
this.setVisible(true);
} public static void main(String[] args) {
NewFrame nf = new NewFrame();
nf.launchFrame(); Insets insets = nf.getInsets();
System.out.println(insets.top);
System.out.println(insets.bottom);
System.out.println(insets.left);
System.out.println(insets.right);
}
}