Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Setting size of JFrame depending on display config

Reply
Thread Tools

Setting size of JFrame depending on display config

 
 
bernd
Guest
Posts: n/a
 
      08-03-2008
Hello folks,

I am working on GUI-project using a dual display (two TFT monitors
attached to the PC) configuration. Normally, I am using an extended
desktop configuration, i.e., windows desktop and the Exceed window
(the development equipment is actually a UNIX-box) span over both
displays.

I retrieve the screen size with
Toolkit.getDefaultToolkit().getScreenSize() happily and adjust the
JFrame-based main window of my application to fractions of the width
and height of the screen size happily.

Some of my unfortunate users :-> do not know about extended desktop
(one even does not switch on the second monitor at his
workplace ), so desktop/Exceed only fills one display and
consequently my GUI is squeezed to half of it's size.

So I studied java's GraphicsConfiguration, GraphisDevice, and
GraphicsEnvironment classes to manage virtual configurations, but now
I am stuck with the getDefaultScreenDevice- and getBounds-methods,
which are useless to determine the number of pixels to assign to the
width and the height fields of the JFrame as long as I do not know how
to find out whether the desktop extends over both or only one display.

The API-doc on GraphicsConfiguration mumbles something about
determining a virtual device environment by checking the origins of
all bounds of the GraphicsConfiguration. It states that one is working
in a virtual device environment as long as at least one of the origins
is not (0,0).

But in my case even if I use both displays all origins of all bounds
are (0,0). I use the getLocation-method on the Bound to find out where
the origin is located.

Am I doing something wrong?

Does somebody know how to adjust the size of the application's main
window in dependency of the used display configuration?

Your help will be appreciated.

Cheers


Bernd

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Can I Get One JFrame To Appear Above Another JFrame clusardi2k@aol.com Java 2 08-27-2012 03:01 PM
Help on setting size of JFrame? A Watcher Java 5 02-23-2008 05:02 AM
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
How to use JSP o/p in JS and depending on that how to display linked word or only word? Sagar Javascript 0 01-18-2006 09:46 AM
Setting style properties in datalist depending on DB-content Jon Henning Bergane ASP .Net Web Controls 2 09-12-2003 05:18 PM



Advertisments