Bem, primeiramente…
valeu pela resposta.
Bem, agora entendi porque o método show() não funciona corretamente no tiger 5.0 (pelo menos não consegui fazer funcionar).
Quanto ao setVisible(true) não sei se é coisa do Tiger (JDK 5.0), mas já aconteceu várias vezes comigo e com outros (inclusive ajudei um rapaz no fórum com o mesmo problema), quando chamado o método setVisible() dentro do construtor, a JVM exibe apenas o Frame e não exibes os outros componentes. Todo componentes Swing. Vou postar meu código e dá uma olhada nisso.
[code]
import java.awt.;
import javax.swing.;
public class Clientes extends JFrame {
JLabel JLNome = new JLabel();
JLabel JLCodCli = new JLabel();
JLabel JLCPF = new JLabel();
JLabel JLRG = new JLabel();
JLabel JLEnd = new JLabel();
JLabel JLBairro = new JLabel();
JLabel JLCidade = new JLabel();
JLabel JLUF = new JLabel();
JLabel JLCep = new JLabel();
JLabel JLTel = new JLabel();
JLabel JLCel = new JLabel();
JLabel JLNasc = new JLabel();
JLabel JLObs = new JLabel();
JTextArea TAObs = new JTextArea();
JTextField tfCod = new JTextField();
JTextField tfCPF = new JTextField();
JTextField tfRG = new JTextField();
JTextField tfNome = new JTextField();
JTextField tfNasc = new JTextField();
JTextField tfEnd = new JTextField();
JTextField tfBairro = new JTextField();
JTextField tfCidade = new JTextField();
JTextField tfUF = new JTextField();
JTextField tfCEP = new JTextField();
JTextField tfCelular = new JTextField();
JTextField tfTel = new JTextField();
JButton JBNovo = new JButton();
JButton JBEditar = new JButton();
JButton JBExcluir = new JButton();
JButton JBConfirmar = new JButton();
JButton JBCancelar = new JButton();
JButton JBFechar = new JButton();
public Clientes() {
try {
iniciar();
this.setVisible(true);
}
catch(Exception e) {
e.printStackTrace();
}
}
private void iniciar() throws Exception {
this.getContentPane().setLayout(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setSize(510,300);
this.setResizable(false);
this.setTitle("Cadastro de Clientes");
JLCodCli.setRequestFocusEnabled(false);
JLCodCli.setText("Código:");
JLCodCli.setBounds(new Rectangle(11, 18, 38, 15));
JLCPF.setRequestFocusEnabled(false);
JLCPF.setText("CPF:");
JLCPF.setBounds(new Rectangle(137, 18, 23, 15));
JLRG.setRequestFocusEnabled(false);
JLRG.setText("RG:");
JLRG.setBounds(new Rectangle(327, 18, 22, 15));
JLNome.setRequestFocusEnabled(false);
JLNome.setText("Nome:");
JLNome.setBounds(new Rectangle(11, 47, 34, 15));
JLEnd.setRequestFocusEnabled(false);
JLEnd.setText("Endereço:");
JLEnd.setBounds(new Rectangle(11, 75, 52, 15));
JLBairro.setRequestFocusEnabled(false);
JLBairro.setText("Bairro:");
JLBairro.setBounds(new Rectangle(11, 105, 34, 15));
JLCidade.setRequestFocusEnabled(false);
JLCidade.setText("Cidade:");
JLCidade.setBounds(new Rectangle(205, 105, 42, 15));
JLUF.setRequestFocusEnabled(false);
JLUF.setText("UF:");
JLUF.setBounds(new Rectangle(429, 105, 17, 15));
JLCep.setRequestFocusEnabled(false);
JLCep.setText("CEP:");
JLCep.setBounds(new Rectangle(11, 134, 34, 15));
JLTel.setRequestFocusEnabled(false);
JLTel.setText("Telefone:");
JLTel.setBounds(new Rectangle(181, 134, 47, 15));
JLCel.setRequestFocusEnabled(false);
JLCel.setText("Celular:");
JLCel.setBounds(new Rectangle(342, 134, 36, 15));
JLNasc.setRequestFocusEnabled(false);
JLNasc.setText("Data de Nascimento:");
JLNasc.setBounds(new Rectangle(307, 47, 100, 15));
JLObs.setRequestFocusEnabled(false);
JLObs.setText("Observações:");
JLObs.setBounds(new Rectangle(11, 160, 81, 15));
TAObs.setRequestFocusEnabled(true);
TAObs.setSelectedTextColor(Color.black);
TAObs.setSelectionEnd(10);
TAObs.setText("");
TAObs.setRows(0);
TAObs.setBounds(new Rectangle(11, 177, 204, 56));
tfCod.setNextFocusableComponent(tfCPF);
tfCod.setText("");
tfCod.setBounds(new Rectangle(62, 15, 70, 21));
tfCPF.setNextFocusableComponent(tfRG);
tfCPF.setText("");
tfCPF.setBounds(new Rectangle(162, 15, 157, 21));
tfRG.setNextFocusableComponent(tfNome);
tfRG.setText("");
tfRG.setBounds(new Rectangle(344, 15, 142, 21));
tfNome.setNextFocusableComponent(tfNasc);
tfNome.setText("");
tfNome.setBounds(new Rectangle(63, 44, 232, 21));
tfNasc.setNextFocusableComponent(tfEnd);
tfNasc.setText("");
tfNasc.setBounds(new Rectangle(406, 44, 80, 21));
tfEnd.setNextFocusableComponent(tfBairro);
tfEnd.setText("");
tfEnd.setBounds(new Rectangle(63, 72, 423, 21));
tfBairro.setNextFocusableComponent(tfCidade);
tfBairro.setText("");
tfBairro.setBounds(new Rectangle(63, 102, 134, 21));
tfCidade.setNextFocusableComponent(tfUF);
tfCidade.setText("");
tfCidade.setBounds(new Rectangle(244, 102, 179, 21));
tfUF.setNextFocusableComponent(tfCEP);
tfUF.setText("");
tfUF.setBounds(new Rectangle(449, 102, 37, 21));
tfCEP.setNextFocusableComponent(tfTel);
tfCEP.setText("");
tfCEP.setBounds(new Rectangle(63, 131, 111, 21));
tfCelular.setNextFocusableComponent(JBConfirmar);
tfCelular.setText("");
tfCelular.setBounds(new Rectangle(381, 130, 105, 22));
tfTel.setNextFocusableComponent(tfCelular);
tfTel.setText("");
tfTel.setBounds(new Rectangle(230, 131, 105, 21));
JBNovo.setBounds(new Rectangle(221, 178, 83, 25));
JBNovo.setNextFocusableComponent(JBEditar);
JBNovo.setText("Novo");
JBEditar.setBounds(new Rectangle(312, 178, 83, 25));
JBEditar.setNextFocusableComponent(JBExcluir);
JBEditar.setText("Editar");
JBExcluir.setBounds(new Rectangle(403, 178, 83, 25));
JBExcluir.setNextFocusableComponent(JBConfirmar);
JBExcluir.setText("Excluir");
JBConfirmar.setBounds(new Rectangle(221, 209, 83, 25));
JBConfirmar.setNextFocusableComponent(JBCancelar);
JBConfirmar.setText("Confirmar");
JBCancelar.setBounds(new Rectangle(312, 209, 83, 25));
JBCancelar.setNextFocusableComponent(JBFechar);
JBCancelar.setText("Cancelar");
JBFechar.setBounds(new Rectangle(403, 209, 83, 25));
JBFechar.setNextFocusableComponent(tfCod);
JBFechar.setText("Fechar");
this.getContentPane().add(TAObs, null);
this.getContentPane().add(tfCPF, null);
this.getContentPane().add(JLCodCli, null);
this.getContentPane().add(JLNasc, null);
this.getContentPane().add(tfNasc, null);
this.getContentPane().add(JLNome, null);
this.getContentPane().add(tfRG, null);
this.getContentPane().add(JLRG, null);
this.getContentPane().add(JLEnd, null);
this.getContentPane().add(tfBairro, null);
this.getContentPane().add(JLBairro, null);
this.getContentPane().add(JLCidade, null);
this.getContentPane().add(tfCidade, null);
this.getContentPane().add(tfUF, null);
this.getContentPane().add(JLUF, null);
this.getContentPane().add(JLCPF, null);
this.getContentPane().add(JLCep, null);
this.getContentPane().add(tfCEP, null);
this.getContentPane().add(tfCelular, null);
this.getContentPane().add(tfNome, null);
this.getContentPane().add(tfEnd, null);
this.getContentPane().add(tfTel, null);
this.getContentPane().add(JLTel, null);
this.getContentPane().add(tfCod, null);
this.getContentPane().add(JBNovo, null);
this.getContentPane().add(JBExcluir, null);
this.getContentPane().add(JLObs, null);
this.getContentPane().add(JBFechar, null);
this.getContentPane().add(JBConfirmar, null);
this.getContentPane().add(JLCel, null);
this.getContentPane().add(JBCancelar, null);
this.getContentPane().add(JBEditar, null);
}
public static void main(String args[]){
Clientes cli = new Clientes();
}
}[/code]
Aliás, nesse caso compilando com tiger, ele exibe vários warns sobre métodos “deprecated”…
E pede pra eu compilar usando javac Clientes.java -Xlint
Alguém sabe o que é isso?