Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
FrmVendedor

FrmVendedor

Ratings: (0)|Views: 940|Likes:
Published by deonatorox

More info:

Published by: deonatorox on Dec 09, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

02/01/2013

pdf

text

original

 
package frm;import java.awt.Color;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.border.LineBorder;import util.Conecta;import bean.BeanVendedor;import dao.DaoVendedor;import dlg.DlgVendedor;public class FrmVendedor extends JFrame {private JPanel painel = new JPanel( null );private JLabel labelCodigo = new JLabel( "Cdigo" );
private JLabel labelNome = new JLabel( "Nome" );private JLabel labelCpf = new JLabel( "CPF" );private JLabel labelRg = new JLabel( "RG" );private JLabel labelSalario = new JLabel( "Salrio base" );
private JLabel labelComissao = new JLabel( "Comisso (%)" );
private JLabel labelValorMeta = new JLabel( "Valor da meta" );private JLabel labelPremiacao = new JLabel( "Premiao (%)" );
��
private JTextField campoCodigo = new JTextField();private JTextField campoNome = new JTextField();private JTextField campoCpf = new JTextField();private JTextField campoRg = new JTextField();private JTextField campoSalario = new JTextField();private JTextField campoComissao = new JTextField();private JTextField campoValorMeta = new JTextField();private JTextField campoPremiacao = new JTextField();private JButton botaoIncluir = new JButton( "Incluir" );private JButton botaoAlterar = new JButton( "Alterar" );private JButton botaoConsultar = new JButton( "Consultar" );private JButton botaoExcluir = new JButton( "Excluir" );private JButton botaoLimpar = new JButton( "Limpar" );private JButton botaoCancelar = new JButton( "Cancelar" );private JButton botaoPesquisar = new JButton( "Pesquisar" );public FrmVendedor(){super( "CADASTRO DE VENDEDORES" );configuraComponentes();posicionaComponentes();adicionaComponentes();adicionaAcoes();
 
}private void configuraComponentes() {setLayout( null );setSize( 800, 600 );setResizable( false );setLocationRelativeTo( null );setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );painel.setBorder( new LineBorder( Color.BLACK ) );botaoIncluir.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );botaoAlterar.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );botaoConsultar.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );botaoExcluir.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );botaoLimpar.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );botaoCancelar.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );botaoPesquisar.setFont( new Font( "SansSerif", Font.ITALIC, 11 ) );}private void posicionaComponentes() {painel.setBounds( 50, 40, 700, 500 );labelCodigo.setBounds ( 10, 10, 100, 20 );labelNome.setBounds ( 10, 35, 100, 20 );labelCpf.setBounds ( 10, 60, 100, 20 );labelRg.setBounds ( 350, 60, 100, 20 );labelSalario.setBounds ( 10, 85, 100, 20 );labelComissao.setBounds ( 10, 110, 100, 20 );labelValorMeta.setBounds ( 10, 135, 100, 20 );labelPremiacao.setBounds ( 10, 160, 100, 20 );campoCodigo.setBounds ( 120, 10, 60, 20 );campoNome.setBounds ( 120, 35, 350, 20 );campoCpf.setBounds ( 120, 60, 150, 20 );campoRg.setBounds ( 450, 60, 150, 20 );campoSalario.setBounds ( 120, 85, 150, 20 );campoComissao.setBounds ( 120, 110, 60, 20 );campoValorMeta.setBounds ( 120, 135, 150, 20 );campoPremiacao.setBounds ( 120, 160, 60, 20 );botaoIncluir.setBounds ( 10, 460, 90, 20 );botaoAlterar.setBounds ( 110, 460, 90, 20 );botaoConsultar.setBounds ( 210, 460, 90, 20 );botaoExcluir.setBounds ( 310, 460, 90, 20 );botaoLimpar.setBounds ( 410, 460, 90, 20 );botaoCancelar.setBounds ( 510, 460, 90, 20 );botaoPesquisar.setBounds ( 200, 10, 90, 20 );}private void adicionaComponentes() {painel.add( labelCodigo );painel.add( labelNome );painel.add( labelCpf );painel.add( labelRg );painel.add( labelSalario );painel.add( labelComissao );
 
painel.add( labelValorMeta );painel.add( labelPremiacao );painel.add( campoCodigo );painel.add( campoNome );painel.add( campoCpf );painel.add( campoRg );painel.add( campoSalario );painel.add( campoComissao );painel.add( campoValorMeta );painel.add( campoPremiacao );painel.add( botaoIncluir );painel.add( botaoAlterar );painel.add( botaoConsultar );painel.add( botaoExcluir );painel.add( botaoLimpar );painel.add( botaoCancelar );painel.add( botaoPesquisar );add( painel );}private void adicionaAcoes() {botaoIncluir.addActionListener ( new AcaoIncluir() );botaoAlterar.addActionListener ( new AcaoAlterar() );botaoConsultar.addActionListener ( new AcaoConsultar() );botaoExcluir.addActionListener ( new AcaoExcluir() );botaoLimpar.addActionListener ( new AcaoLimpar() );botaoCancelar.addActionListener ( new AcaoCancelar() );botaoPesquisar.addActionListener ( new AcaoPesquisar() );}private class AcaoIncluir implements ActionListener{public void actionPerformed( ActionEvent e ) {try{Connection conn = Conecta.getConexao();BeanVendedor vendedor = new BeanVendedor(); vendedor.setCodigo( DaoVendedor.getChavePrimaria( conn ) );vendedor.setNome ( campoNome.getText() );vendedor.setCpf ( campoCpf.getText() );vendedor.setRg ( campoRg.getText() );vendedor.setSalarioBase( Double.parseDouble( campoSalario.getText() ) );vendedor.setComissao( Double.parseDouble( campoComissao.getText() ) );vendedor.setValorMeta( Double.parseDouble( campoValorMeta.getText() ) );vendedor.setPremiacao( Double.parseDouble( campoPremiacao.getText() ) ); DaoVendedor.incluir( conn, vendedor ); }catch ( SQLException ex ) {ex.printStackTrace();

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->