Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

adjusting to screen resolution

 
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
Mac OS X IntelliJ IDE Chrome
  • 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
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic