title: How to change Background color when i click a button
body: <p>My Problem is only just a little part that change color.I want to change the whole background when i click those buttons.I search already in google nothing happens.</p>
  
  <p>I Use Panel but it seems not only a little part that it can changes i want a whole background.</p>
  
  <pre><code>import java.awt.event.MouseListener;
  import javax.swing.JOptionPane;
  import java.awt.event.*;
  /**
   *
   * 
   * @author Christopher Porras
   * @Version 0.1
   * @Doing GUI
   */
  public class Button extends JFrame {
  
     private JButton bred;
     private JButton bblue;
     private JButton bgreen;
     private JPanel mousepanel; 
  
  
      public Button()
      {
          super("ChangeColor");
          setLayout(new FlowLayout());
          setSize(200,200);
  
          mousepanel = new JPanel();
          mousepanel.setBackground(Color.white);
          add(mousepanel);
  
          bred = new JButton("REd");
          add(bred);
  
          bblue = new JButton("Blue");
          add(bblue);
  
          bgreen = new JButton("Green");
          add(bgreen);
  
          thehandler handler = new thehandler();
          bred.addMouseListener(handler);
          bblue.addMouseListener(handler);
          bgreen.addMouseListener(handler);
      }
  
      private class thehandler implements MouseListener
      {
  
  
          public void mouseClicked(MouseEvent e)
          {
              if(e.getSource()==bred)
              {
                  mousepanel.setBackground(Color.red);
              }
  
               else if(e.getSource()==bblue)
              {
                  mousepanel.setBackground(Color.blue);
              }
  
               else if(e.getSource()==bgreen)
              {
                  mousepanel.setBackground(Color.green);
              }
          }
  
  
          public void mousePressed(MouseEvent e) {
  
          }
  
          public void mouseReleased(MouseEvent e) {
  
          }
  
  
          public void mouseEntered(MouseEvent e) {
  
          }
  
  
          public void mouseExited(MouseEvent e) {
                //To change body of generated methods, choose Tools | Templates.
          }
  
  
  
      }
  
      public static void main(String[]args)
      {
          Button button = new Button();
          button.setVisible(true);
          button.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      }
  </code></pre>