0

Possible Duplicate:
Java application automatically resize to fit screen resolution

I have to create a desktop application using Java Swing. It's working fine on a large screen monitor (18.5 inch).

I want to reduce the size of windows, but now controls are overlapping, some controls hide others, how will I handle my code for dynamically using the larger screen (18.5 inch) and smaller screen(14 inch)?

I handled the layout for all screens but screens will display correctly...only the controls are overlapping each other.

Community
  • 1
  • 1
  • 3
    First, you need to think in pixels, not inches. – John U Oct 17 '12 at 12:14
  • 3
    _I handled the layout for all screen_ if that means you did sizing/locating manually then you now experience the pain for such wrongdoing ;-) Use LayoutManagers. – kleopatra Oct 17 '12 at 12:16
  • @JohnU don't you mean portals? – lynks Oct 17 '12 at 12:17
  • @lynks - No, the atomic unit of screen space is the pixel. Everything else is elastic/faked/scaled/made-up depending on the particular system the user is using and cannot be relied upon to be the same from your screen to anyone else's. – John U Oct 17 '12 at 12:23

1 Answers1

2

To answer one of your questions, you can get the window bounds, not including a task bar, with the following call.

Rectangle w = GraphicsEnvironment.getLocalGraphicsEnvironment()
            .getMaximumWindowBounds();

To answer the question you didn't ask, you must use a Swing layout manager for your GUI to scale from one monitor size to another.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111