Sumit Deshpande
Sumit Deshpande

Reputation: 105

How to maximize JFrame

How to maximize JFrame while loading the form? I am using Netbeans 7.3.1 so I am unable to edit initComponents() auto generated code please suggest me any alternate way so that I can maximize my JFrame at start-up.

Upvotes: 0

Views: 3782

Answers (2)

Java Devil
Java Devil

Reputation: 10959

Try this,

JFrame.setState(Frame.MAXIMIZED_BOTH)

read about frame states here

Upvotes: 2

SeniorJD
SeniorJD

Reputation: 7202

JFrame frame = new JFrame();
Rectangle bounds = getmaximizedBounds(); // set your maximized bounds
frame.setMaximizedBounds(bounds);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

Upvotes: 2

Related Questions