title: mouse Clicked event change colors
body: <p>Well the goal of this program is to create a bullseye; and when you click on the panel, it will change the color of the bullseye from red to blue. When you click on mine nothing happens. What is causing this?</p>
  
  <pre><code>import java.awt.*;
  
  public class TargetLogoPanel extends javax.swing.JPanel {
  
  public Color ringColor = Color.RED;
  public int size = 400;
  public TargetLogoPanel() {
  
      setBackground(Color.WHITE);
      setPreferredSize(new Dimension(700,400 ));
  }
  
  @Override
  protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      int width = getWidth();
          int height = getHeight();
  
         int radius = getHeight();
  
       g.setColor(ringColor);
          g.fillOval(
                  (int)((width/2 ) - (radius * 0.3)),
                  (int)((height/2) - (radius * 0.3)), 
                  (int)(radius * .6), 
                  (int)(radius * .6));
          g.setColor(Color.WHITE);
          g.fillOval(
                  (int)((width / 2) - (radius * 0.22)),
                  (int)((height / 2) - (radius * 0.22)), 
                  (int)(radius * 0.44), 
                  (int)(radius * 0.44));
          g.setColor(ringColor);
          g.fillOval(
                  (int)((width / 2) - (radius * 0.15)),
                  (int)((height / 2) - (radius * 0.15)), 
                  (int)(radius * 0.3), 
                  (int)(radius * 0.3));
  }
  
  /**
   * 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() {
  
      addMouseListener(new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
              formMouseClicked(evt);
          }
      });
  
      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
      this.setLayout(layout);
      layout.setHorizontalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGap(0, 400, Short.MAX_VALUE)
      );
      layout.setVerticalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGap(0, 300, Short.MAX_VALUE)
      );
  }// &lt;/editor-fold&gt;                        
  
  private void formMouseClicked(java.awt.event.MouseEvent evt) {                                  
     if(ringColor == Color.RED){
         ringColor = Color.BLUE;
         repaint();
     } else{
         ringColor = Color.RED;
         repaint();
     }
  }                                 
  
  
  // Variables declaration - do not modify                     
  // End of variables declaration                   
  }
  </code></pre>