• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

adjusting to screen resolution  RSS feed

 
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
 
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!