participate


Reflections & Reference Objects - How can I get Screen Desktop size?
<<   Back to Forum  |   Give us Feedback
This topic has 5 replies on 1 page.
goodmorningsky
Posts:94
Registered: 4/13/02
How can I get Screen Desktop size?   
Sep 24, 2002 1:56 PM

 
How can I get Screen Desktop size.
I can get Screen size using DefaultToolkit.getScreenSize()
but, How can I get Desktop size which is the Screen size without taskbar height(usually on the bottom showing start button and trays..in window platform) in the window platform?

Thank you...
 
mlk
Posts:10,967
Registered: 8/15/01
Re: How can I get Screen Desktop size?   
Sep 24, 2002 3:18 PM (reply 1 of 5)  (In reply to original post )

 
You can not, not without either JNI or maximising the window and using that.
 
neek2000
Posts:5
Registered: 5/14/01
Re: How can I get Screen Desktop size?   
Sep 24, 2002 5:32 PM (reply 2 of 5)  (In reply to original post )

 
you can detract the taskbar's height by yourself.
 
vladB
Posts:1
Registered: 2/26/98
Re: How can I get Screen Desktop size?   
Oct 2, 2002 9:00 AM (reply 3 of 5)  (In reply to original post )

 
With jdk1.4, the following works for me...


GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();

Rectangle bounds = env.getMaximumWindowBounds();

Regards,
Andrew B.
 
shefalipanchal
Posts:80
Registered: 12/4/02
Re: How can I get Screen Desktop size?   
May 24, 2004 4:46 AM (reply 4 of 5)  (In reply to #3 )

 
Hi,

I know this thread seems to have been unread in a long while, but I had a question... The given code works brilliantly for windows, but the panel used in Linux is not identified by this code... The screen size and max bounds returned are identical...

Anything I can do there other than JNI?

Shefali
 
AlexKrasov
Posts:1
Registered: 7/23/04
Re: How can I get Screen Desktop size?   
Jul 23, 2004 6:59 PM (reply 5 of 5)  (In reply to #4 )

 
Hi!

I using a different way to get desctop size. I do not try it on Linux, but on Windows it works well. Try the folowing:

int maxHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0].getDisplayMode().getHeight();
int maxWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0].getDisplayMode().getWidth();


Because of it is possible to have more then one graphic device, you have array as result of getScreenDevices(). For me it is works well to use allways a first one. You can implement you own logic.

Hopes it help.

Alex Krasov
 
This topic has 5 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums