Pq não esta funcionando meu ActionListener?
[code] entra.addActionListener(new Evento());
}
}
class VerificaLogo implements ActionListener{
public void actionPerformed(ActionEvent e){
if(e.getSource()== entra){
new Tela();
}
}
}
[/code]
O codigo todo da tela vai aki em baixo
[code]package Modelo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Login extends JFrame{
JFrame Logo = new JFrame(); // Referente a tela do login.
JLabel im= new JLabel(new ImageIcon ("src/Modelo/im.jpg"));// Referente a imagem de fundo.
//Aqui é referente aos campos de usuario e senha.
JTextField usuario = new JTextField();
JTextField senha = new JTextField();
// Aqui é referente aos rotulos de usario e senha.
JLabel rotulo1 =new JLabel("Usuario");
JLabel rotulo2 = new JLabel("Senha");
// Referente aos botões de entra e cancela.
JButton entra = new JButton();
JButton cancela = new JButton(new ImageIcon(getClass().getResource("im.jpg")));
//Esse metodo é referente a exibição da tela do login, por ele que chamamos no main
public Login(){
// Referente as propriedades da tela.
Logo.setLayout(null);
Logo.setLocationRelativeTo( null );//para centralizar no meio da tela.
Logo.setUndecorated(true);
Logo.setSize(330,70);
//Container c = Logo.getContentPane();
//c.setLayout(null);
//c.setBackground(Color.green);
//Referente as propriedade de add.
Logo.getContentPane().add(im);
Logo.add(rotulo1);
Logo.add(rotulo2);
Logo.add(usuario);
Logo.add(senha);
Logo.add(entra);
Logo.add(cancela);
// Referente a imagem de fundo da tela do logo.
//im.setVisible(true);
//im.setSize(330,70);
//im.setLocation(0,0);
//im.setBackground(null);
// Referente as posição e tamanhos.
rotulo1.setVisible(true);
rotulo1.setSize(80,20);
rotulo1.setLocation(10,10);
rotulo2.setVisible(true);
rotulo2.setSize(80,20);
rotulo2.setLocation(10,40);
usuario.setVisible(true);
usuario.setSize(150,20);
usuario.setLocation(70,10);
senha.setVisible(true);
senha.setSize(150,20);
senha.setLocation(70,40);
entra.setVisible(true);
entra.setSize(70,20);
entra.setLocation(250,10);
cancela.setVisible(true);
cancela.setSize(70,20);
cancela.setLocation(250,40);
//add actionlistener no botão.
//Referente a visibilidade da tela do logo,
// Obs. a visibilidade deve ficar sempre no fim da tela.
Logo.setVisible(true);
Logo.setDefaultCloseOperation(EXIT_ON_CLOSE);
entra.addActionListener(new Evento());
}
}
class VerificaLogo implements ActionListener{
public void actionPerformed(ActionEvent e){
if(e.getSource()== entra){
new Tela();
}
}
}
[/code]