Estou tentado dar ação em um Jbutton masi não estou conseguindo alguém sabe o porque…?? vou colocar o código para ficar mais fácil a visualização
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class CriptografiaGUI extends JFrame
{
private Color cor;
private JButton botao;
private JLabel texto1;
public CriptografiaGUI(String titulo)
{
super(titulo);
setLayout(new FlowLayout());
this.texto1=new JLabel("Trabalho de Mátematica Discreta");
add(this.texto1);
this.botao=new JButton("OK");
add(this.botao);
setVisible(true);
setSize(500, 500);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent event)
{
if(event.equals("OK"))
{
JOptionPane.showMessageDialog(null, "Testes");
}
}
public static void main(String args[])
{
new CriptografiaGUI("Trabalho de Matématica discreta");
}
}