I have been trying to get the window to automatically maximize using Netbeans.
I’ve probably looked through 4 or 5 pages of Google for an answer.
The web pages always provide something like this:
public void run() {
MyFrame myFrame = new MyFrame();
myFrame.setVisible(true);
myFrame.setExtendedState(myFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
}
I am using Netbeans 6.9.1
Does this no longer work? Is there another way to do this?
Also, if you find your answer on a web page, please provide the link so I can look into this further. Thanks in advance for any input! 🙂
Regarding
setExtendedState(), “Note that if the state is not supported on a given platform, nothing will happen.”If that’s not relevant, an sscce may be helpful.
Addendum: This example seems to function correctly:
Addendum: The relevant state constants appear to form a coherent set. In particular,
MAXIMIZED_HORIZ | MAXIMIZED_VERT == MAXIMIZED_BOTH: