2

How to set constraint On the Image so that Image should not spills out JFrame Window

1 Answers1

1

To alter the size of your image you can crop or resize (scale) your image. The sizes to which resize your image's can be get from the size of the frame.

If you have a frame

JFrame frame = new JFrame();
frame.setVisible(true);

you can get frame's size:

Dimension windowSize = frame.getContentPane().getSize();
System.out.println(windowSize);
Community
  • 1
  • 1