aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Screen resolution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Screen resolution" Watch "Screen resolution" New topic
Author

Screen resolution

Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
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


Courage is not the absence of fear but rather the judgment that something is more important then fear. ~ Ambrose Redmond
Oleg Tikhonov
Ranch Hand

Joined: Aug 02, 2008
Posts: 55
Hi,
Did you try like that?



Hope it helps.
Oleg Tikhonov
Ranch Hand

Joined: Aug 02, 2008
Posts: 55
for more information look at Toolkit
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

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)


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

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.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36499
    
  16
Moving thread to our GUIs forum.
Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
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
Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 88
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.


Karthick D V
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

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

Joined: Jul 31, 2009
Posts: 84
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

Joined: Feb 23, 2008
Posts: 88
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
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Screen resolution
 
Similar Threads
Problem in detecting Resolution change
MAking JFrame flexible - Resolution based
ExamLab SCJP 5 by Devaka cooray
Screen resolution
How to change the resolution of screen using JavaScript