I'm new to java, and here's a question I can't find the answer in Java doc and Google.
In my case, I want wanna restrict the height(just height) of a panel(which nested in a panel with BoxLayout), so I add codes like below:
p2.setMaximumSize(new Dimension(10000, 30));
It works fine until then.
The problem is that the numeric 10000 is some kid of ugly as you can see.
I want to know are there any constants to indicate a big enough number so I can replace the number 10000 with one of them. Or maybe are there any other better ways I can make it?
Unless I'm missing something, you could use Integer.MAX_VALUE like so,
p2.setMaximumSize(new Dimension(Integer.MAX_VALUE, 30));
There are many possible solutions, another is to use the Screen Height, for example
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int maxHeight = gd.getDisplayMode().getHeight();