• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Screen resolution

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

I'm trying to get the screen resolution (eg: 1152 x 864) of a pc that is currently running the program, but i cant seem to get it to work.

Iv changed the the resolution a couple of time but i always get the same result 96 but i think its because it takes the whole screens pixels per inch?



Is there a way to get the current resolution that is being used?

thanks
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Did you try like that?



Hope it helps.
 
Oleg Tikhonov
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for more information look at Toolkit
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lila Fowler wrote:hi all,

I'm trying to get the screen resolution (eg: 1152 x 864) of a pc that is currently running the program, but i cant seem to get it to work.

Iv changed the the resolution a couple of time but i always get the same result 96 but i think its because it takes the whole screens pixels per inch?



Is there a way to get the current resolution that is being used?

thanks



its called ppi (pixels per inch)
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Screen size and screen resolution are two different things.
Size refers to the well size of your monitor
Resolution will give you the density of the pixels.I think it is dots per inch (dpi)

The Toolkit class has methods for retrieving both these parameters.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving thread to our GUIs forum.
 
Lila Fowler
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, i am looking for the resolution, not the screen size. when i run that code it only returns 96 no matter what i make the resolution. Is there a way to get the current resolution being used. eg: 1280 by 720?

thanks
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Did you try



I checked it with my resolution as 1280 * 1204. Screen Size's width was returned as 1280 and height was returned as 1204.
I changed my resolution to 1280 * 800. Screen Size's width was returned as 1280 and height was returned as 800.

May be you can try that and check.
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:Screen size and screen resolution are two different things.
Size refers to the well size of your monitor
Resolution will give you the density of the pixels.I think it is dots per inch (dpi)

The Toolkit class has methods for retrieving both these parameters.


dpi is related to printing.
its the dots per inch on paper, hence the term "dot" as opposed to "pixel"
http://en.wikipedia.org/wiki/Pixel_density
http://en.wikipedia.org/wiki/Dots_per_inch

Lila Fowler, the answer provided by Oleg Tikhonov is correct, have you tried that?
 
Lila Fowler
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just finished trying it, thanks it works great, but now im really confused because i thought that getScreenSize returned the actual measurements of the screen itself. Sorry, Thanks for all your help.
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. It does return the size of the screen. BUT NOT THE PHYSICAL SIZE.

It returns you the PIXEL SIZE OF THE SCREEN. Like 1024 * 768. You can accomodate these many number of pixels in this screen.
Obviously, when your resolution changes, the number of pixels that you can accomodate (i.e the size) changes
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lila Fowler wrote:I just finished trying it, thanks it works great, but now im really confused because i thought that getScreenSize returned the actual measurements of the screen itself. Sorry, Thanks for all your help.



Do you mean Monitor size like 15inch or 17inch ?
If yes,
I confess i do not know how that can be achieved, and i am curious to why do you require that info..
 
Arthur, where are your pants? Check under this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic