Setting size of JFrame depending on display config

Discussion in 'Java' started by bernd, Aug 3, 2008.

  1. bernd

    bernd Guest

    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
     
    bernd, Aug 3, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hardy Wang
    Replies:
    2
    Views:
    1,517
    Joe Fallon
    Jul 31, 2004
  2. jakester
    Replies:
    3
    Views:
    1,898
    jakester
    Apr 3, 2007
  3. CSharpner
    Replies:
    0
    Views:
    1,129
    CSharpner
    Apr 9, 2007
  4. A Watcher

    Help on setting size of JFrame?

    A Watcher, Feb 22, 2008, in forum: Java
    Replies:
    5
    Views:
    26,884
    thenerdwonder
    Feb 23, 2008
  5. Replies:
    2
    Views:
    439
    markspace
    Aug 27, 2012
Loading...

Share This Page