title: Jframe not the right size when its executed, any reason why?
body: <p>I am making a game but whenever i run the second jFrame I have to resize it in order to get the right size for the second jFrame, anyone know why?</p>
  
  <p>here is the method in the first jFrame class that opens the second one:</p>
  
  <pre><code>  private void playButtonMouseClicked(java.awt.event.MouseEvent evt) {                                        
          if (playerOneNameText.getText().equals(""))
          {
          }
  
          if (playerTwoNameText.getText().equals(""))
          {
          }
          else{
          pOneName = playerOneNameText.getText();
          pTwoName = playerTwoNameText.getText();
  
          ChessBoardUI class1 = new ChessBoardUI(); // Creating object of Class1
          class1.setVisible(true);
  
          this.setVisible(false);
          }
      } 
  </code></pre>
  
  <p>here is the second jFrame class that is the one that I have to resize in order to ge tit right:</p>
  
  <pre><code>package chess;
  
  public class ChessBoardUI extends javax.swing.JFrame {
  
      public ChessBoardUI() {
          initComponents();
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      @SuppressWarnings("unchecked")
      // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;
      private void initComponents() {
  
          jLabel2 = new javax.swing.JLabel();
          jLabel3 = new javax.swing.JLabel();
          jLabel1 = new javax.swing.JLabel();
          jLabel4 = new javax.swing.JLabel();
          blackTeamName = new javax.swing.JLabel();
          whiteTeamName = new javax.swing.JLabel();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
          getContentPane().setLayout(null);
          getContentPane().add(jLabel2);
          jLabel2.setBounds(21, 49, 0, 0);
  
          jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/chess/board.jpg"))); // NOI18N
          getContentPane().add(jLabel3);
          jLabel3.setBounds(0, 30, 400, 400);
  
          jLabel1.setText("Black:");
          getContentPane().add(jLabel1);
          jLabel1.setBounds(400, 100, 34, 16);
  
          jLabel4.setText("White:");
          getContentPane().add(jLabel4);
          jLabel4.setBounds(400, 150, 38, 16);
  
          blackTeamName.setText("jLabel5");
          getContentPane().add(blackTeamName);
          blackTeamName.setBounds(400, 120, 41, 16);
  
          whiteTeamName.setText("jLabel5");
          getContentPane().add(whiteTeamName);
          whiteTeamName.setBounds(400, 170, 41, 16);
  
          pack();
      }// &lt;/editor-fold&gt;
  
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt;
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(ChessBoardUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(ChessBoardUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(ChessBoardUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(ChessBoardUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //&lt;/editor-fold&gt;
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new ChessBoardUI().setVisible(true);
              }
          });
      }
      // Variables declaration - do not modify
      private javax.swing.JLabel blackTeamName;
      private javax.swing.JLabel jLabel1;
      private javax.swing.JLabel jLabel2;
      private javax.swing.JLabel jLabel3;
      private javax.swing.JLabel jLabel4;
      private javax.swing.JLabel whiteTeamName;
      // End of variables declaration
  }
  </code></pre>