Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

adjusting to screen resolution  RSS feed

 
basha khan
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai everybody,
All Operating Systems are supporting different screen resolutions.How can i make my window even(same size) for all resolutions?.What are the best possible ways?.I checked System.getproperties().but that method does not include resolution.how can i adjust?
Welcome to all solutions and tricks..
basha
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not 100% sure I understand what you are trying to do. But look at the following methods:
Tookit.getDefaultToolkit().getScreenSize - returns Dimension
So then when you set the size of your Frame you can do:
setSize(Dimension.width, Dimension.height)
If you need to place your frame in the middle of the screen you can do
setLocation( (screen.width)-frameWidth)/2, (screen.height)-frameHeight)/2 )
If you need to actually control the Resolution of the Desktop, say change it from 800x600 to 1024x768, you can't with pure JAVA.
If you want the Frame to change it's actual width and height with different Resolutions so that it appears to take up the same amount of desktop area, then use the getScreenSize method and then do some calculations when setting the size of your Frame accordingly.
 
basha khan
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai greg,
If you want the Frame to change it's actual width and height with different Resolutions so that it appears to take up the same amount of desktop area, then use the getScreenSize method and then do some calculations when setting the size of your Frame accordingly.

this is what i really wanted.i expected utility method for this purpose.but it was not there.is'nt it?.
a method like 'fixSizeForAllResolutions()' can be a good utility method.because most of the applicaions having GUI and java supports cross-platform.
thanks for ur reply anyhow it helped me.
wishing u a good day..
basha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!