title: Complications converting Swing application to an Applet
body: <p>I finally got this calculator application in Netbeans to compile correctly and run client-side with no errors but for some reason I cannot get it to work as an applet. I have spent a lot of time trying to figure this out and researching but to no avail. Any experts around to take a quick look and see what the problem is? </p>
  
  <p>I'd really appreciate any suggestions, thanks.</p>
  
  <pre><code>package eventhandler;
  
  import javax.swing.JApplet;
  
  public class CalculatorApplet extends JApplet {
  
  
      @Override
      public void init() {
  
      }
  
      @SuppressWarnings("unchecked")
  
      private void initComponents() {
  
          firstText = new javax.swing.JTextField();
          secondText = new javax.swing.JTextField();
          postLabel = new javax.swing.JLabel();
          postButton = new javax.swing.JButton();
          comboBox = new javax.swing.JComboBox();
          jButton1 = new javax.swing.JButton();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  
          postButton.setText("Solve");
          postButton.addActionListener(new java.awt.event.ActionListener() {
              @Override
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  postName(evt);
              }
          });
  
          comboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "+", "-", "*", "/" }));
  
          jButton1.setText("Clear");
          jButton1.addActionListener(new java.awt.event.ActionListener() {
              @Override
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  clearFields(evt);
              }
          });
  
          org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
              .add(layout.createSequentialGroup()
                  .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                      .add(layout.createSequentialGroup()
                          .add(47, 47, 47)
                          .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                              .add(org.jdesktop.layout.GroupLayout.LEADING, secondText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
                              .add(org.jdesktop.layout.GroupLayout.LEADING, firstText)
                              .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                                  .add(21, 21, 21)
                                  .add(comboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                      .add(layout.createSequentialGroup()
                          .addContainerGap()
                          .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                              .add(postLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                              .add(postButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 91, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                          .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                          .add(jButton1)))
                  .addContainerGap(24, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
              .add(layout.createSequentialGroup()
                  .addContainerGap()
                  .add(firstText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 28, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                  .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                  .add(secondText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 28, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                  .add(comboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                  .add(18, 18, 18)
                  .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                      .add(postButton)
                      .add(jButton1))
                  .add(5, 5, 5)
                  .add(postLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                  .addContainerGap())
          );
  
          //pack();
      }// &lt;/editor-fold&gt;
  
      private void postName(java.awt.event.ActionEvent evt) {
          String ft = firstText.getText();
          String lt = secondText.getText(); 
          String total;
          double parse1, parse2;
  
          Object selectedCombo = comboBox.getSelectedItem();
  
          if (selectedCombo == "+") {
              parse1 = Double.parseDouble(ft);
              parse2 = Double.parseDouble(lt);
              total = String.valueOf(parse1 + parse2);
              postLabel.setText(total);
  
          } else if (selectedCombo == "-") {
              parse1 = Double.parseDouble(ft);
              parse2 = Double.parseDouble(lt);
              total = String.valueOf(parse1 - parse2);
              postLabel.setText(total);
  
          } else if (selectedCombo == "*") {
              parse1 = Double.parseDouble(ft);
              parse2 = Double.parseDouble(lt);
              total = String.valueOf(parse1 * parse2);
              postLabel.setText(total);
  
          } else if (selectedCombo == "/") {
              parse1 = Double.parseDouble(ft);
              parse2 = Double.parseDouble(lt);
              total = String.valueOf(parse1 / parse2);
              postLabel.setText(total);
          }
  
      }
  
      private void clearFields(java.awt.event.ActionEvent evt) {
          firstText.setText(null);
          secondText.setText(null);
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          java.awt.EventQueue.invokeLater(new Runnable() {
  
              @Override
              public void run() {
                  new EventGUI().setVisible(true);
              }
          });
      }
      // Variables declaration - do not modify
      private javax.swing.JComboBox comboBox;
      private javax.swing.JTextField firstText;
      private javax.swing.JButton jButton1;
      private javax.swing.JButton postButton;
      private javax.swing.JLabel postLabel;
      private javax.swing.JTextField secondText;
      // End of variables declaration
  
      private void setDefaultCloseOperation(int EXIT_ON_CLOSE) {
          throw new UnsupportedOperationException("Not yet implemented");
      }
  }
  </code></pre>