• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • 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.
1 Solution
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);

 // see http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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