1

In Swing Application, JFrame is not changing its size behaviour according to screen resolution.

I tried

pack();

and

Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension d = toolkit.getScreenSize();
height = d.height;
width = d.width;
this.setSize(width, height);

and

GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    width = gd.getDisplayMode().getWidth();
    height = gd.getDisplayMode().getHeight();

Using GraphicsDevice there is no change.

When I change resolution JFrame and components goes behind the taskbar and complete frame will not display.

I want JFrame and all components to resize according to various screen resolutions.

  • Possible duplicate: https://stackoverflow.com/questions/6777135/java-jframe-size-according-to-screen-resolution?rq=1 – Alexander Heim Sep 14 '17 at 12:14
  • Possible duplicate of [Java JFrame Size according to screen resolution](https://stackoverflow.com/questions/6777135/java-jframe-size-according-to-screen-resolution) – Alexander Heim Sep 14 '17 at 12:15

1 Answers1

1

You could try this:

this.setExtendedState(JFrame.MAXIMIZED_BOTH);
Aleksandr
  • 428
  • 2
  • 8
  • 14