/**
 * Material de autoria do professor André Aparecido da Silva (andre@oxnar.com.br)
 * Para ser utilizado pela turma 3.A INF do Colégio Maria Aguiar Teixeira
 */
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;

public class Tela03 extends JFrame implements ActionListener
{
	
    	JButton bt_Proximo, bt_Limpar, bt_Sair;
    	JPanel Painel1, Painel2, Painel3; 
    	JLabel  lbl_Nome; 	
    	int i = 1; 	
    	public Tela03() 
    	{
    			setLayout( new GridLayout(3, 1));
    			getContentPane().add(Painel1 = new JPanel ());
    			Painel1.add(new JLabel("EXERCÍCIO DA AULA PASSADA:")); 
    			
    			getContentPane().add(Painel2 = new JPanel ()); 
    			Painel2.add(lbl_Nome = new JLabel("COMEÇANDO O EXERCÍCIO")); 
    			Painel2.setBackground(Color.white);
    			getContentPane().add(Painel3 = new JPanel (new FlowLayout(FlowLayout.CENTER))); 
    			Painel3.add(bt_Proximo = new JButton("PRÓXIMO"));
    			Painel3.add(bt_Limpar = new JButton("APAGAR"));
    			Painel3.add(bt_Sair = new JButton("SAIR"));
    			//Painel3.setBackground(Color.darkGray);
    			 
    			bt_Proximo.addActionListener(this); 
    			bt_Limpar.addActionListener(this);
    			bt_Sair.addActionListener(this);
    			setTitle("MINHA 2. TELA");
    			pack();
    			setResizable(false); 
    			setVisible(true);	
    				
    	
    	}
 
    	public void actionPerformed(ActionEvent e)    	
    	{
 				if(e.getSource()==bt_Proximo)
 				{
 						if(i == 0)
 						{	
 								lbl_Nome.setText("COMEÇANDO O EXERCÍCIO");
 								i = i + 1; 
 						}	
 
 						else if(i == 1)
 						{	
 								lbl_Nome.setText("LETICIA");
 								i = i + 1; 
 						}	
 
 						else if(i == 2)
 						{	
 								lbl_Nome.setText("YURI");
 								i = i + 1; 
 						}
 	
 						else if(i == 3)
 						{	
 								lbl_Nome.setText("JOÃO");
 								i = 0; 
 						}
  						else if(i > 3)
 						{	
 								
 								i = 0; 
 						}													
 								
 																					
 				}	
    			if(e.getSource()==bt_Limpar)
    			{
    					lbl_Nome.setText("");
    					lbl_Nome.setText("....");
    					i = 1; 
    			}	
    			if(e.getSource()==bt_Sair)
    					{System.exit(0);}
    	}	
    	public static void main (String args [])
    	{
    			new Tela03();
    	}		
    
    
}