o codigo e meio grande.
mas ta ai:
CODIGO esta e a CLASS CLIENTE:
[code]
import javax.swing.JOptionPane;
//import javax.swing.JOptionPane;
/*
- Created on 29/06/2005
-
- TODO To change the template for this generated file go to
- Window - Preferences - Java - Code Style - Code Templates
*/
/**
-
@author André Muniz
-
- TODO To change the template for this generated type comment go to
- Window - Preferences - Java - Code Style - Code Templates
*/
public class Cliente {
private String nome = this.getNome();
private char sexo;
private String end;
private int cep;
private String estado;
private String cidade;
//private static final String = null;
public Cliente (String nome,char sexo,String end,int cep,String estado,String cidade) {
this.nome = nome;
this.sexo = sexo;
this.end = end;
this.cep = cep;
this.estado = estado;
this.cidade = cidade;
}
/**
* @param nome2
*/
/**
*
*/
public Cliente() {
// TODO Auto-generated constructor stub
}
/**
*
*/
public void setNome(String nome){
this.nome = nome;
}
public String getNome(){
return this.nome;
}
public char getSexo(){
return this.sexo;
}
public String getEnd(){
return this.end;
}
public int getCep(){
return this.cep;
}
public String getEstado(){
return this.estado;
}
public String getCidade(){
return this.cidade;
}
public char setSexo(){
return this.sexo;
}
public String setEnd(){
return this.end;
}
public int setCep(){
return this.cep;
}
public String setEstado(){
return this.estado;
}
public String setCidade(){
return this.cidade;
}
//**************Imprime Dados************
public void imprimeDados(){
//System.out.println("Nome: "+this.getNome());
JOptionPane.showMessageDialog(null,"Nome: "+this.getNome());
}
} [/code]/
ESTA E A PRINCIPAL(MAIN):
[code]
/*
- Created on 29/06/2005
-
- TODO To change the template for this generated file go to
- Window - Preferences - Java - Code Style - Code Templates
*/
/**
-
@author André Muniz
-
- TODO To change the template for this generated type comment go to
- Window - Preferences - Java - Code Style - Code Templates
/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.;
import java.io.Serializable;
import javax.swing.*;
public class Principal extends JFrame {
String l = "mestre";
//String s = "root";
JPasswordField s = new JPasswordField("root");
public Principal() {
for( int i = 1; i <= 1; i++ )
{
String l = javax.swing.JOptionPane.showInputDialog( null, "Coloque o Login","Janela de LOGIN",JOptionPane.INFORMATION_MESSAGE );
Serializable s = javax.swing.JOptionPane.showInputDialog( null, "Coloque a Senha","Janela de SENHA",JOptionPane.INFORMATION_MESSAGE );
if( l.equals( "mestre" ) && s.equals( "root" ) )
{
JOptionPane.showMessageDialog(null,"PERMETIDA A ENTRADA","PERMISSÃO",JOptionPane.OK_CANCEL_OPTION);
JFrame f1 = new JFrame();
}else {
System.exit(1);
//return false;
}
}
//super("#Cadastration 0.5# - Software Private");
Container c = getContentPane();
setSize(250,190);
c.setLayout(new BorderLayout());
JPanel pBotoes = montapBotoes();
JPanel pPric = montapPric();
c.add(new JLabel("Cadastro de Clientes"),BorderLayout.NORTH);
c.add(pBotoes,BorderLayout.SOUTH);
c.add(pPric,BorderLayout.CENTER);
setVisible(true);
}
/**
* @return
*/
private JPanel montapBotoes() {
final Cliente c = new Cliente();
// TODO Auto-generated method stub
JPanel p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.CENTER));
JButton bSalvar = new JButton("Salvar");
setMnemonic('S');
p.add(bSalvar);
JButton bExcluir = new JButton("Excluir");
setMnemonic('x');
p.add(bExcluir);
JButton bNovo = new JButton("Novo");
setMnemonic('N');
p.add(bNovo);
bSalvar.addActionListener (
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
Cliente c = new Cliente();
JPanel p = new JPanel();
c.imprimeDados();
}
}
);
return p;
}
/**
* @return
*/
/**
* @param c
*/
private void setMnemonic(char c) {
// TODO Auto-generated method stub
}
/**
* @return
*/
private JPanel montapPric() {
// TODO Auto-generated method stub
JPanel p = new JPanel();
Cliente c = new Cliente();
p.setLayout(new GridLayout(6, 2));
JTextField tfNome = new JTextField("", 50);
JTextField tfSexo = new JTextField("", 1);
JTextField tfEnd = new JTextField("", 50);
JTextField tfCep = new JTextField("", 15);
JTextField tfEstado = new JTextField("", 2);
JTextField tfCidade = new JTextField("", 30);
p.add(new JLabel("Nome: "));
p.add(tfNome);
p.add(new JLabel("Sexo: "));
p.add(tfSexo);
p.add(new JLabel("Endereço: "));
p.add(tfEnd);
p.add(new JLabel("CEP: "));
p.add(tfCep);
p.add(new JLabel("Estado: "));
p.add(tfEstado);
p.add(new JLabel("Cidade: "));
p.add(tfCidade);
return p;
}
/**
* @param exit_on_close
*/
private void getCloseDefaultOperation(int exit_on_close) {
// TODO Auto-generated method stub
}
public static void main(String args[]){
Principal p = new Principal();
}
}[/code]
ESTA AI;;
SE PUDER ME AJUDAR FICAREI GRATO!!
VALEU
:rockets: