[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

code in a window


I need to Specify the size of the window(called "myWin") to

be 450 pixels wide by 375 pixels in depth

then cause the window's upper Left hand corner to appear at (50,75)

then cause the window to appear on the screen   and then have JAVA terminate execution when the application is closed.
0
usumle
Asked:
usumle
1 Solution
 
aozarovCommented:
JFrame frame = new JFrame(); // add your elements to the frame

frame.setBounds(50, 75, 450, 375); // Since java 1.5 see: http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Window.html#setBounds(int, int, int, int)

or instead do:
frame.setLocation(50, 75);
frame.setSize(450, 375);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 // see http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now