Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JFrame problem

Status
Not open for further replies.

ankursaxena

Programmer
Sep 7, 2001
133
US
Hi! I am having trouble developing swing based GUI, i dont understand how do i develope on my machine which has vey high resolution and make it look the same in smaller screen and lesser resolution, becuase as of now, when i create a JFrame with 1000x1000 it looks just fone on my desktop but when i open it up on a laptop, it goes out of the screen..how do i do this resolution ratio?

please some one help

also if some one knows how to maximize a JFrame automatically when you are displaying it, that would be awesome too.

thanx a ton
Ankur
 
Use setBounds with the ScreenSize

Where a exemple:

int space = 50;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

int wdFrame = screenSize.width - space * 2;
int hgFrame = screenSize.height - space * 2;
setBounds(space, space, wdFrame, hgFrame);
 
I tried this and it put the frame in the middle of the screen. How can i make the frame max size for the monitor?
thanks in advance,
j
 
JFrame frame1 = new JFrame("go2");

Dimension screenSize= Toolkit.getDefaultToolkit().getScreenSize();
int wdFrame = screenSize.width;
int hgFrame = screenSize.height;

frame1.setSize(wdFrame, hgFrame);

why doesnt this make the frame max size? If i follow this right, the getScreenSize gets the size, and then sets the variables to the max width and height. Then the frame should be set to the max size.
thanks in advance
j
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top