title: How can I make a JFrame to go fullscreen after clicking the default fullscreen button?
body: <p>I want to build a JFrame with a default size. But After the default fullscreen button is clicked, the frame will cover the full screen of monitor &amp; what's inside the frame will readjust itself with the new frame size.</p>
  
  <p>My question is how can I do that?</p>
  
  <p>Here is the code i have written so far.  </p>
  
  <pre><code>public class ApplicationFrame extends JFrame{
  private static ApplicationFrame ref;
  
  private ApplicationFrame(){
      ref=this;
      this.setTitle("Business Management");
      this.setBounds(50, 50, 1400, 800);
      this.setExtendedState(JFrame.MAXIMIZED_BOTH);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.setVisible(true);
  }
  
  public static ApplicationFrame getRef(){
      if(ApplicationFrame.ref==null)
          new ApplicationFrame();
      return ref;
  }
  }
  </code></pre>
  
  <p>**Here is the picture of the button I am talking about
  <a href="https://i.stack.imgur.com/WudQq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WudQq.jpg" alt="**Here is the picture of the button I am talking about"></a>  </p>