Setting size of JFrame depending on display config



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

.



Relevant Pages

  • The breakpoint will not currently be hit. No symbols have been loaded for this document.
    ... debugger is skipping my breakpoint. ... In fact initially the window is empty. ... system.xml.dll display in the window. ... debugging information" checked for my project, and my configuration ...
    (microsoft.public.vsnet.debugging)
  • An array of panels for a configuration window
    ... I decided that the most elegant solution would be to go for a treeview where you select the category, and then the right side of the window will display a panel that contains the related configuration options. ... Currently, we're talking about 5-10 pages of configuration settings, and it might expand to 15-20 in the near future. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SVGA, LCD, Win CE 6.0 and PB
    ... site addressing display drver issues, not to mention the source code. ... travel down thru Win CE from boot.ini to the place genrating final LCD ... I can have a desktop larger than physical screen window. ...
    (microsoft.public.windowsce.platbuilder)
  • Question about Full screen exclusive mode
    ... I use ScreenManager class that has been presented in David Brackeen's book. ... The graphics card enters the selected mode but the window content is painted only to the level of windows display mode.For example. ... After returning to the Windows, the settings dialog window is repainted with the content of the frame that is under settings dialog. ...
    (comp.lang.java.programmer)
  • Re: display array in a frame wnd
    ... I have to display results. ... The window can be used in all the program thanks to the name "source image". ... CFrameWnd* pw; ... Why is this not in an OnPaint handler? ...
    (microsoft.public.vc.mfc)