Setting size of JFrame depending on display config

B

bernd

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top