I want to set the Maximum size of the JFrame while launching the application. Problem is, if the screen resolution is more my frame is getting bigger , but at that time it should not cross the max range defined, but same case works fine with low resolution.
Like I want my frame to be of Maximum of (500,500) , so I wrote this piece of code:
JFrame frame = new JFrame("FRAME TRANSPARENT");
frame.setSize((int)(Toolkit.getDefaultToolkit().getScreenSize().getWidth()-50), (int)(Toolkit.getDefaultToolkit().getScreenSize().getHeight()-150));
frame.setMaximizedBounds(new Rectangle(0,0 , 500, 500));
frame.setVisible(true);
Even I set the Bound, the JFrame is considering setSize method and it seems to be that it is neglecting the setMaximizedBounds method. I already tried with setMaximumized method but got the same output.
setMaximizedBounds
instead ofsetMaximumSize
?