title: Changing the size of a jFrame on button click
body: <p>I'm creating a "Presentation" on a jFrame as part of a project and need some help.
  I have it starting as a 200, 200 size frame with a button in the middle that says "Let's Start"
  then when you click on it, the size of the frame changes. When I click on the button you have to drag the window to make it the already defined size seen as the window stays the original 200 by 200 it doesn't open the window to 1335 by 675.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>package randomGUIs;
  
  import java.awt.Color;
  import java.awt.Dimension;
  
  public class Presentation extends javax.swing.JFrame {
  
  public Presentation() {
      initComponents();
  
      startPanel.setBackground(Color.blue);
  
  }
  
  @SuppressWarnings("unchecked")
  // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;                          
  private void initComponents() {
  
      startPanel = new javax.swing.JPanel();
      jButton1 = new javax.swing.JButton();
  
      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  
      jButton1.setText("Let's Start");
      jButton1.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
              jButton1ActionPerformed(evt);
          }
      });
  
      javax.swing.GroupLayout startPanelLayout = new javax.swing.GroupLayout(startPanel);
      startPanel.setLayout(startPanelLayout);
      startPanelLayout.setHorizontalGroup(
          startPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(startPanelLayout.createSequentialGroup()
              .addGap(50, 50, 50)
              .addComponent(jButton1)
              .addContainerGap(49, Short.MAX_VALUE))
      );
      startPanelLayout.setVerticalGroup(
          startPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(startPanelLayout.createSequentialGroup()
              .addGap(78, 78, 78)
              .addComponent(jButton1)
              .addContainerGap(77, Short.MAX_VALUE))
      );
  
      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
              .addContainerGap()
              .addComponent(startPanel, javax.swing.GroupLayout.DEFAULT_SIZE,      javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
              .addContainerGap())
      );
      layout.setVerticalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
              .addContainerGap()
              .addComponent(startPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
              .addContainerGap())
      );
  
      pack();
  }// &lt;/editor-fold&gt;                        
  
  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
  
      startPanel.setSize(new Dimension(1335, 675));
      startPanel.setMaximumSize(new Dimension(1335, 675));
      startPanel.setMinimumSize(new Dimension(1335, 675));
  
      jButton1.setVisible(false);
  
  }                                        
  
  public static void main(String args[]) {
  
      java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
              new Presentation().setVisible(true);
          }
      });
  }
  
  private javax.swing.JButton jButton1;
  private javax.swing.JPanel startPanel;
  </code></pre>
  
  <p>}</p>
  
  <p>I've tried using <code>startPanel.repaint();</code> with no luck. </p>