GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Very Silly UI resize problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Very Silly UI resize problem" Watch "Very Silly UI resize problem" New topic
Author

Very Silly UI resize problem

Suchak Jani
Ranch Hand

Joined: Jan 24, 2002
Posts: 68
Team,
I am trying to get the maximum screen size and the resize my UI accordingly. It just does not seem to work.
I have tried both :
resize using Dimension on the frame.
resize using int width and int height on the frame.

I have the following code

I know this must be very silly, but i cannot figure it out.
Regards
Suchak Jani
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I simply hard coded the size and made it not resizable
Here's the code I used

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Suchak Jani
Ranch Hand

Joined: Jan 24, 2002
Posts: 68
Mark
I guess i will do the same.
Thanks and Regards
Suchak Jani
Rajesh Matti
Ranch Hand

Joined: Jan 07, 2002
Posts: 121
Suchak - Problem is with your code. To get the max dimension use ToolKit.getDefaultToolKit().getScreenSize() and set your frame's size to that.
-Rajesh
tom mcmorrow
Ranch Hand

Joined: Jan 11, 2002
Posts: 39
hi all
I was wondering if setting it as mark suggests limits the application to monitors with resolutions of greater than width 900. I have used rajesh method however i find on a large screen it looks somewhat out of propotion for my particular UI.
tom
Suchak Jani
Ranch Hand

Joined: Jan 24, 2002
Posts: 68
Rajesh,
Suchak - Problem is with your code. To get the max dimension use ToolKit.getDefaultToolKit().getScreenSize() and set your frame's size to that.
Yes ! it works.
Dimension d = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
f.setSize((int)(d.getWidth()),(int)(d.getHeight()/2));
I do not get why though ?
I mean the code that does not work below:-
Dimension d = f.getMaximumSize();
f.setSize((int)(d.getWidth()),(int)(d.getHeight()/2));
looks just like the above code that works.
Both return Dimension Objects and then based on that Object try to set the frame size.
Can some more light be thrown on why ?
Note: i have tested both and i am sure that one works and the other does not.
Regards
Suchak Jani
[ March 13, 2002: Message edited by: Suchak Jani ]
 
GeeCON Prague 2014
 
subject: Very Silly UI resize problem