import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;

public class  Interface_Pedido extends  JFrame implements ActionListener, ItemListener
{
		JMenuBar Barra_De_Menu = new JMenuBar();
		JMenu Menu_Arquivo, Menu_Perfil, Menu_Pedido,  Menu_Produtos; 
		JMenu Menu_Cadastros, Menu_Administracao, Menu_Modulos, Menu_Ajuda;
		JMenuItem MenuItem_Modulo_Cadastros, MenuItem_Modulo_Pedidos, MenuItem_Modulo_Financeiro, MenuItem_Modulo_Clientes;
		
		JMenuItem MenuItem_Cad_Produtos, MenuItem_Cad_Usuarios,  MenuItem_Cad_Pedidos, Menu_Interface_Cliente, MenuItem_Sair;
		JMenuItem MenuItem_Backup, MenuItem_Restaurar_Backup,  MenuItem_Alterar_Senha;  	                
		JButton bt_Pedidos, bt_Produtos, bt_Perfil;
		JCheckBoxMenuItem MenuItem_Habilita_Pedidos,  MenuItem_Habilita_Perfil,  MenuItem_Habilita_Produtos;
		JPanel Painel_Oeste, Painel_Centro, Painel_Leste, Painel_Sul, Painel_Norte;
		//Painel a Oeste
		JPanel Painel_Oeste1, Painel_Oeste2, Painel_Oeste3, Painel_Oeste4, Painel_Oeste5; 
		//Painel ao Centro
		JPanel Painel_Centro1, Painel_Centro2, Painel_Centro3, Painel_Centro4, Painel_Centro5, Painel_Centro6, Painel_Centro7, Painel_Centro8; 
		//Painel ao Leste
		JPanel Painel_Leste1,  Painel_Leste2,  Painel_Leste3,  Painel_Leste4,  Painel_Leste5, Painel_Leste6; 
		JPanel Painel_Botoes;	
			
		JTextField 		tf_Cod_Cliente, tf_Nome_Cliente, tf_Numero_Pedido, tf_Endereco, tf_Data_Pedido, tf_Data_Entrega;
		JTextField      tf_Cidade, tf_Bairro, tf_Cep, tf_Complemento;
		JComboBox 		cbb_Estado 			= new JComboBox ();
		JComboBox 		cbb_Pgto 			= new JComboBox ();
		JComboBox 		cbb_Status 			= new JComboBox ();
		JTextField 		tf_Observacoes 		= new JTextField(25);
		JButton bt_Gravar, bt_Atualizar, bt_Excluir_Item, bt_Exluir_Pedido, bt_Fechar;
		JScrollPane Painel_Rolante 				= new JScrollPane();
		JTable 			Tabela_de_Pedidos;
		JLabel lbl_ItensPedido;
		
		public Interface_Pedido()
		{
				setLayout(new BorderLayout());		
				getContentPane().add("North", Painel_Norte	= new JPanel());//ver qual será o layout deste painel
				getContentPane().add("West", Painel_Oeste 	= new JPanel(new GridLayout(8, 1)));
				Painel_Oeste.add(Painel_Oeste1 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste1.add(new JLabel ("CÓDIDO DO CLIENTE:"));
				Painel_Oeste.add(Painel_Oeste2 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste2.add(new JLabel ("ENDEREÇO:"));
				Painel_Oeste.add(Painel_Oeste3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste3.add(new JLabel ("CIDADE:"));
				Painel_Oeste.add(Painel_Oeste4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste4.add(new JLabel ("COMPLEMENTO:"));
				Painel_Oeste.add(Painel_Oeste5 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste5.add(new JLabel ("FORMA PGTO:"));
				getContentPane().add("Center", Painel_Centro	= new JPanel(new GridLayout(8, 1)));
				
				Painel_Centro.add(Painel_Centro1 	= new JPanel(new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro1.add(tf_Cod_Cliente 	= new JTextField(10));
				Painel_Centro1.add(tf_Nome_Cliente 	= new JTextField(30));
				Painel_Centro.add(Painel_Centro2 	= new JPanel(new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro2.add(tf_Endereco		= new JTextField(40));
				Painel_Centro.add(Painel_Centro3 	= new JPanel(new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro3.add(tf_Cidade 		= new JTextField(20));
				Painel_Centro3.add(new JLabel(" UF:"));
				Painel_Centro3.add(cbb_Estado);
				cbb_Estado.addItem("SELECIONE O ESTADO"); 
				cbb_Estado.addItem("EXPORTAÇÃO");
				cbb_Estado.addItem("AC - ACRE");
			    cbb_Estado.addItem("AL - ALAGOAS");
				cbb_Estado.addItem("AP - AMAPA");
				cbb_Estado.addItem("AM - AMAZONAS");
				cbb_Estado.addItem("BA - BAHIA");
				cbb_Estado.addItem("CE - CEARA");
				cbb_Estado.addItem("DF - DISTRITO FEDERAL");
				cbb_Estado.addItem("ES - ESPIRITO SANTO");
				cbb_Estado.addItem("GO - GOIÁS"); 
				cbb_Estado.addItem("MA - MARANHÃO");
				cbb_Estado.addItem("MT - MATO GROSSO");
				cbb_Estado.addItem("MS - MATO GROSSO DO SUL"); 
				cbb_Estado.addItem("MG - MINAS GERAIS");
				cbb_Estado.addItem("PA - PARÁ");
				cbb_Estado.addItem("PB - PARAÍBA");
				cbb_Estado.addItem("PR - PARANÁ"); 
				cbb_Estado.addItem("PE - PERNANBUCO"); 
				cbb_Estado.addItem("PI - PIAUÍ");
				cbb_Estado.addItem("RJ - RIO DE JANEIRO"); 
				cbb_Estado.addItem("RN - RIO GRANDE DO NORTE"); 
				cbb_Estado.addItem("RS - RIO GRANDE DO SUL");
				cbb_Estado.addItem("RD - RONDÔNIA"); 
				cbb_Estado.addItem("RR - RORAIMA");
				cbb_Estado.addItem("SC - SANTA CATARINA");
				cbb_Estado.addItem("SP - SÃO PAULO");
				cbb_Estado.addItem("SE - SERGIPE");
				cbb_Estado.addItem("TO - TOCANTINS");
				Painel_Centro.add(Painel_Centro4 	= new JPanel(new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro4.add(tf_Complemento	= new JTextField(40));
				Painel_Centro.add(Painel_Centro5 	= new JPanel(new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro5.add(cbb_Pgto);
				cbb_Pgto.addItem("SELECIONE A FORMA DE PAGAMENTO");
				cbb_Pgto.addItem("A VISTA");
				cbb_Pgto.addItem("CONTRA ENTREGA");
				cbb_Pgto.addItem("CARTÃO DE CRÉDITO");
				cbb_Pgto.addItem("30 DIAS DO PEDIDO");
				cbb_Pgto.addItem("30/60 DIAS DO PEDIDO");
				cbb_Pgto.addItem("60 DIAS DO PEDIDO");
				cbb_Pgto.addItem(".....");
				cbb_Pgto.addItem(".....");
				cbb_Pgto.addItem(".....");
				///////
				Painel_Centro.add(Painel_Centro6 = new JPanel ());
				Painel_Centro.add(Painel_Centro7 = new JPanel ());
				Painel_Centro.add(Painel_Centro8 = new JPanel (new GridLayout(1, 1)));
				Painel_Centro8.add( lbl_ItensPedido = new JLabel ("ITENS DO PEDIDO", SwingConstants.CENTER));
				lbl_ItensPedido.setBackground(Color.orange);
				////
				getContentPane().add("East", Painel_Leste	= new JPanel(new GridLayout(8, 1)));
				Painel_Leste.add(Painel_Leste1 = new JPanel (new FlowLayout(FlowLayout.RIGHT))); 
  	
				Painel_Leste1.add(new JLabel("Nº PEDIDO:"));

				Painel_Leste1.add(tf_Numero_Pedido = new JTextField(14));	
				
				Painel_Leste.add(Painel_Leste2 = new JPanel (new FlowLayout(FlowLayout.RIGHT))); 
 
				Painel_Leste2.add(new JLabel ("BAIRRO"));
			    Painel_Leste2.add(tf_Bairro		= new JTextField(14));
				
				Painel_Leste.add(Painel_Leste3 = new JPanel (new FlowLayout(FlowLayout.RIGHT))); 
				  
				Painel_Leste3.add( new JLabel("CEP:"));
				Painel_Leste3.add(tf_Cep = new JTextField(14));
				Painel_Leste.add(Painel_Leste4 = new JPanel (new FlowLayout(FlowLayout.RIGHT))); 
				Painel_Leste4.add(new JLabel("DATA PEDIDO: "));
				Painel_Leste4.add(tf_Data_Pedido = new JTextField(14));
				Painel_Leste.add(Painel_Leste5 = new JPanel (new FlowLayout(FlowLayout.RIGHT)));
				Painel_Leste5.add(new JLabel("DATA ENTREGA:"));
				Painel_Leste5.add(tf_Data_Entrega = new JTextField(14)); 
				Painel_Leste.add(Painel_Leste6 = new JPanel (new FlowLayout(FlowLayout.RIGHT)));
				Painel_Leste6.add(new JLabel("STATUS DO PEDIDO:"));
				Painel_Leste6.add(cbb_Status);
				cbb_Status.addItem("SELECIONE O STATUS...");
				cbb_Status.addItem("PEDIDO RECUSADO");
				cbb_Status.addItem("PEDIDO EM ANALISE");
				cbb_Status.addItem("PEDIDO FATURADO");
				cbb_Status.addItem("PEDIDO ENTREGUE");
				cbb_Status.addItem("PEDIDO ATRASADO");

				
				
				
				
				//ADICIONAR O PAINEL6 E ADICIONAR O CAMPO STATUS					
				////
 
         
        		//actual data for the table in a 2d array
        		Object[][] data = new Object[][] 
        		{
            			{1, "John", 40.0, false },
            			{2, "Rambo", 70.0, false },
            			{3, "Zorro", 60.0, true },
        		};
				Painel_Rolante.add(Tabela_de_Pedidos = new JTable());
				//títulos das tabelas
				//Dados atuais para linhas e colunas.
        		
				getContentPane().add("South", Painel_Sul		= new JPanel(new BorderLayout()));//ver qual será o layout deste painel
				/*
				 *Adicionar na parte central do painel sul o painel_rolante com os itens
				 **/
 
				 
				Painel_Sul.add("South", Painel_Botoes = new JPanel(new FlowLayout(FlowLayout.CENTER)));
				Painel_Botoes.add( bt_Gravar				= new JButton("GRAVAR PEDIDO"));
				Painel_Botoes.add( bt_Atualizar			= new JButton("ATUALIZAR PEDIDO"));
				Painel_Botoes.add( bt_Excluir_Item			= new JButton("EXCLUIR ITEM"));
				Painel_Botoes.add( bt_Exluir_Pedido		= new JButton("EXCLUIR PEDIDO"));
				Painel_Botoes.add( bt_Fechar				= new JButton("FECHAR TELA"));
 
				bt_Gravar.addActionListener(this);
				bt_Atualizar.addActionListener(this);
				bt_Excluir_Item.addActionListener(this);
				bt_Exluir_Pedido.addActionListener(this);
				bt_Fechar.addActionListener(this);
				
				///////////////PARA FECHAR A JANELA/////
 				addWindowListener(new WindowAdapter()
 				{
           			public void windowClosing(WindowEvent fecharJanela)
           			{
                			System.exit(0);//Mudar para dispose();
            		}
        		});
				///////////////////////////////////////
				setTitle("SISTEMAX - PEDIDOS");
				//pack();
				//setSize(850, 700);
				pack();
				setVisible(true);
		}
		public void actionPerformed (ActionEvent e)
		{
				if(e.getSource()==bt_Gravar)
				{
					
				}
				if(e.getSource()==bt_Atualizar)
				{
					
				}
				if(e.getSource()==bt_Excluir_Item)
				{
					
				}
				if(e.getSource()==bt_Exluir_Pedido)
				{
					
				}
				if(e.getSource()==bt_Fechar)
				{
						System.exit(0); //Mudar para dispose();
				}
					
		}
		public void itemStateChanged(ItemEvent e)
		{
		}
		public static void main (String args [])
		{
				new Interface_Pedido();
		}	

	
}
