import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class ojava extends JFrame implements ActionListener
{
        JButton bt_Vermelho, bt_Mescla, bt_Verde, bt_Amarelo, bt_Branco, bt_Preto, bt_orange, bt_pink, bt_Azul;
        JButton bt_Sair, bt_Nova;
        int Cor = 0;
        public ojava()
        {
                setVisible(true);
                setSize(500, 600);
                this.setLocationRelativeTo(null);
                getContentPane().setBackground(Color.orange);
                setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                setResizable(false);
                getContentPane().setLayout(new BorderLayout());
                JPanel P1 =  new JPanel();
                P1.setLayout(new GridLayout(10, 1) );
                getContentPane().add( P1, BorderLayout.WEST);
                P1.add(bt_Vermelho = new JButton("VERMELHO"));
                P1.add(bt_Verde    = new JButton("VERDE"));
                P1.add(bt_Amarelo  = new JButton("AMARELO"));
                P1.add(bt_Branco   = new JButton("BRANCO"));
                P1.add(bt_Preto    = new JButton("PRETO"));
                P1.add(bt_pink     = new JButton("Pink"));
                P1.add(bt_Azul     = new JButton("Azul"));
                P1.add(bt_Mescla    = new JButton("Mescla"));
                P1.add(bt_Nova     = new JButton("Nova Janela"));
                P1.add(bt_Sair     = new JButton("Sair"));
                bt_Vermelho.addActionListener(this);
                bt_Verde.addActionListener(this);
                bt_Amarelo.addActionListener(this);
                bt_Branco.addActionListener(this);
                bt_Preto.addActionListener(this);
                bt_Azul.addActionListener(this);
                bt_pink.addActionListener(this);
                bt_Sair.addActionListener(this);
                bt_Nova.addActionListener(this);
                bt_Mescla.addActionListener(this);
        }
        public static void main (String args [])
        {
                new ojava();
        }
        public void actionPerformed(ActionEvent e)
        {
                if(e.getSource()==bt_Vermelho) { getContentPane().setBackground(Color.red);}
                if(e.getSource()==bt_orange)   {getContentPane().setBackground(Color.orange);}
                if(e.getSource()==bt_Verde)    {getContentPane().setBackground(Color.green);}
                if(e.getSource()==bt_Amarelo)  {getContentPane().setBackground(Color.yellow);}
                if(e.getSource()==bt_Branco)   {getContentPane().setBackground(Color.white);}
                if(e.getSource()==bt_Preto)    {getContentPane().setBackground(Color.black);}
                if(e.getSource()==bt_Azul)     {getContentPane().setBackground(Color.blue);}
                if(e.getSource()== bt_pink)    {getContentPane().setBackground(new Color(255, 105, 180));}
                if(e.getSource()== bt_Mescla)  {getContentPane().setBackground(new Color(46, 46, 46));}
                if(e.getSource()==bt_Sair)     {System.exit(0);}
                if(e.getSource()==bt_Nova)     {new ojava();}
        }
}
