setMaximumSize() on a JFrame problem
Hi, I will just post some simple code to explain.
JFrame myFrame = new MainGrid();
JFrame.setDefaultLookAndFeelDecorated(true);
myFrame.setMinimumSize(new Dimension(800,550));//Works
myFrame.setMaximumSize(new Dimension(1000,750));//Doesnīt work
The method setMininumSize works perfectly on my GUI, but then how come that I canīt set the maximum size of my window? It looks like it ignores the code.
Ty, Val.
Making JFrame Maximum Size
The following might help you solve the problem:
Code:
public class Program extends JFrame
{
public Program()
{
Rectangle maxBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().
getMaximumWindowBounds();
this.setSize(maxBounds.width, maxBounds.height);
}//end of constructor
}//end of class Program
Good Luck