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
Suchak - Problem is with your code. To get the max dimension use ToolKit.getDefaultToolKit().getScreenSize() and set your frame's size to that. -Rajesh
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
posted
0
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 ]