Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
karthikeya Boyini

To maximize JFrame in Java Swing, use the following −

JFrame.MAXIMIZED_BOTH

The following is an example to maximize JFrame in Java −

Example

package my;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class SwingDemo extends JFrame {
   JPanel panel = new JPanel();
   public SwingDemo() {
      setVisible(true);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setAlwaysOnTop(true);
      setResizable(true);
      setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
   }
   public static void main(String[] args) { new SwingDemo();
   }
}

The output is as follows. Here, the JFrame is visible with no border and title −

Output

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.