さて、各テキストフィールドはアクションリスナーです。私は多くのテストを行い、アクションリスナーを追加することは問題ではないことを発見しました。問題は以下のコードのどこかにあります。これは、上位4つのテキストフィールドについて、helloウィンドウが表示されますが、okは表示されないためです。しかし、一番下のウィンドウでは、okウィンドウとhelloウィンドウがポップアップします。私は何を間違えましたか?
public class handler implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == text)
{
JOptionPane.showMessageDialog(null, "ok");
}
else if (event.getSource() == text1)
{
JOptionPane.showMessageDialog(null, "ok");
}
else if (event.getSource() == text2)
{
JOptionPane.showMessageDialog(null, "ok");
}
else if (event.getSource() == text3)
{
JOptionPane.showMessageDialog(null, "ok");
}
else if (event.getSource() == text4)
{
JOptionPane.showMessageDialog(null, "ok");
}
JOptionPane.showMessageDialog(null, "hello");
}
}