title: Java swing applet freezes when button run
body: <p>This is code I wrote for an applet using swing.  The program lets the user enter any extra items (peripherals), which shipping method they want to use, and then allows them to push buttons that calculate their total costs either with or without shipping depending on the button they push.
  The problem is, when I run it, it freezes and doesn't do anything after I click either of the calculate buttons.  Does anyone see anything wrong with my code that could be causing this?
  Thank you.</p>
  
  <pre><code> package selling;
  
  
  public class midtermComputers extends javax.swing.JApplet {
  public double calculateCost(int quantity){
  
       double discountedPrice=getDiscountPercentage(quantity);
         double finalCost=0;
       if (isShipping()&amp;(groundRadioButton.isSelected())&amp;quantity&lt;100){
       finalCost= ((discountedPrice*.05)+discountedPrice)*quantity;
       }
          if (isShipping()&amp;(groundRadioButton.isSelected())&amp;quantity&gt;100){
       finalCost=discountedPrice*quantity;
       }     
           if (isShipping()&amp;(airRadioButton.isSelected())){
       finalCost= discountedPrice*.1*quantity;
       }
           if (isShipping()&amp;(fedExRadioButton.isSelected())){
       finalCost= discountedPrice*.2*quantity;
  }
           if (!isShipping()){
       finalCost= discountedPrice*quantity;
   }
           return finalCost;
   }
  
  private void calcWithShippingButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                       
      int quantity=1;
      double finalCost=calculateCost(quantity);
  outputTextPane.setText(outputTextPane.getText() + quantity + "\t" + finalCost  + "\n" );
       quantity=100;
   while(quantity&lt;=1000){
  outputTextPane.setText(outputTextPane.getText() + quantity + "\t" + finalCost  + "\n" );
  quantity=quantity+100;
      }
  
      }                                                      
  
  private void calcWithoutShippingButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                          
     int quantity=1;
      double finalCost=calculateCost(quantity);
  outputTextPane.setText(outputTextPane.getText() + quantity + "\t" + finalCost  + "\n" );
   quantity=100;
   while(quantity&lt;=1000){
  outputTextPane.setText(outputTextPane.getText() + quantity + "\t" + finalCost  + "\n" );
  quantity=quantity+100;
  }
  }                                                         
  
  public double calculateCost(){
  double base=399.00;
  double costOneUnit=0.0;
            double speakerPeripheral=0.0;
            double printerPeripheral=0.0;
            double scannerPeripheral=0.0;
            double microphonePeripheral=0.0;
            double projectorPeripheral=0.0;
            double plotterPeripheral=0.0;
  
  while(speakerCheckBox.isSelected()){
     speakerPeripheral=89.00;
  }
  
  while(printerCheckBox.isSelected()){
    printerPeripheral=59.00;
  }
   while(scannerCheckBox.isSelected()){
    scannerPeripheral=415.00;
   }
   while(microphoneCheckBox.isSelected()){
    microphonePeripheral=39.00;
   }
   while(projectorCheckBox.isSelected()){
    projectorPeripheral=549.00;
   }
   while(plotterCheckBox.isSelected()){
    plotterPeripheral=4883.00;
   }
   return costOneUnit=base+speakerPeripheral+printerPeripheral+scannerPeripheral+microphonePeripheral+projectorPeripheral+plotterPeripheral;
  
  }
  
  
  public boolean isShipping(){
  if(calcWithShippingButton.isSelected()){
      return true;
  } else{
      return false;
  }
  }
  
  public double getDiscountPercentage(int quantity){
      double costOneUnit=calculateCost();
      double discountedPrice=0;
  
      while (quantity&lt;100){
  discountedPrice=costOneUnit;
  }
      while (quantity&gt;100&amp;quantity&lt;=199){
       discountedPrice=(costOneUnit-(costOneUnit*.01))*quantity;
  
  }
      while (quantity&gt;200&amp;quantity&lt;=299){
       discountedPrice=(costOneUnit-(costOneUnit*.02))*quantity;
  }
      while (quantity&gt;300&amp;quantity&lt;=399){
       discountedPrice=(costOneUnit-(costOneUnit*.03))*quantity;
  }
      while (quantity&gt;400&amp;quantity&lt;=499){
       discountedPrice=(costOneUnit-(costOneUnit*.04))*quantity;
  }
      while (quantity&gt;500&amp;quantity&lt;=599){
       discountedPrice=(costOneUnit-(costOneUnit*.05))*quantity;
  }
      while (quantity&gt;600&amp;quantity&lt;=699){
       discountedPrice=(costOneUnit-(costOneUnit*.06))*quantity;
  }
      while (quantity&gt;700&amp;quantity&lt;=799){
       discountedPrice=(costOneUnit-(costOneUnit*.07))*quantity;
  }
      while (quantity&gt;800&amp;quantity&lt;=899){
       discountedPrice=(costOneUnit-(costOneUnit*.08))*quantity;
  }
      while (quantity&gt;900&amp;quantity&lt;=999){
       discountedPrice=(costOneUnit-(costOneUnit*.09))*quantity;
  }
      while(quantity&lt;=1000&amp;quantity&gt;999){
        discountedPrice=(costOneUnit-(costOneUnit*.1))*quantity;  
      }
     return discountedPrice;
  }  
  </code></pre>