
import java.util.Date.*; 
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;

public class  Interface_PedidoT 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_Oeste6, Painel_Oeste7, Painel_Oeste8; 
		//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, Painel_Leste7, Painel_Leste8; 
		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;
		JTextField 		tf_Codigo, tf_Produto, tf_ValorUnitario, tf_Quantidade, tf_Valor_total;
		JTextField      tf_Valor_Total_Pedido;
		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, bt_AdicionarItem;
		JScrollPane Painel_Rolante; 
		JTable 			Tabela_de_Pedidos;
		JLabel lbl_ItensPedido;
 		///////////////////////////
		String [] colunas = {"CÓDIGO", "PRODUTO", "QUANTIDADE", "VALOR UNITÁRIO", "VALOR TOTAL"};
		Object [][] dados = {
									{"001", "PLACA MAE ASSUS - ", "06", "302,00", "1812,00"},
									{"002", "NOTEBOOK ACER - ", "08", "1500,00", "12000,00"},
									{"003", "MONITOR - ", "05", "400,00", "2012,00"},
									{"004", "TV 42'' -  ", "3", "1500,00", "1812,00"},
									{"005", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"006", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"007", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"008", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"009", "PLACA MAE - ", "06", "302,00", "1812,00"},
										{"003", "MONITOR - ", "05", "400,00", "2012,00"},
									{"004", "TV 42'' -  ", "3", "1500,00", "1812,00"},
									{"005", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"006", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"007", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"008", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"009", "PLACA MAE - ", "06", "302,00", "1812,00"},
																		{"003", "MONITOR - ", "05", "400,00", "2012,00"},
									{"004", "TV 42'' -  ", "3", "1500,00", "1812,00"},
									{"005", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"006", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"007", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"008", "PLACA MAE - ", "06", "302,00", "1812,00"},
									{"009", "PLACA MAE - ", "06", "302,00", "1812,00"},									
									
									
							};
		JTable tabela = new JTable(dados, colunas);
		
		public Interface_PedidoT()
		{
				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:"));
				Painel_Oeste.add(Painel_Oeste6 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste6.add(new JLabel ("TOTAL DO PEDIDO:"));
				Painel_Oeste.add(Painel_Oeste7 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Oeste7.add(new JLabel ("COD ITEM:"));
				Painel_Oeste7.setBackground(Color.yellow);
				
				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 (new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro6.add(tf_Valor_Total_Pedido = new JTextField(20));
				Painel_Centro.add(Painel_Centro7 = new JPanel (new FlowLayout(FlowLayout.LEFT)));
				Painel_Centro7.add(tf_Codigo = new JTextField(5));
				Painel_Centro7.add(new JLabel ("Produto:"));
				Painel_Centro7.add(tf_Produto = new JTextField(20));// tf_ValorUnitario,  tf_Valor_total;
				Painel_Centro7.setBackground(Color.yellow);
				Painel_Centro7.add(new JLabel("QTDE:"));
				Painel_Centro7.add(tf_Quantidade = new JTextField(5));
					
				
				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");
				Painel_Leste.add(Painel_Leste7 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Leste7.add(new JLabel("VALOR UNITÁRIO:"));
				Painel_Leste7.add(tf_ValorUnitario = new JTextField(14));
				Painel_Leste7.setBackground(Color.yellow);
				Painel_Leste.add(Painel_Leste8 = new JPanel(new FlowLayout(FlowLayout.RIGHT)));
				Painel_Leste8.add(bt_AdicionarItem = new JButton ("+ ADICIONAR ITEM"));
				
				
				
			
        		
				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
				 **/
				JScrollPane  Painel_Rolante 				= new JScrollPane(tabela);
 				Painel_Sul.add("Center",Painel_Rolante); 
 				Painel_Rolante.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
				Painel_Rolante.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
				
				
				
				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);
				bt_AdicionarItem.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(560, 200);
				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_PedidoT();
		}	

	
}
