私のプログラムには 2 つのボタンがあり、システムの印刷を行うには両方をクリックする必要があります。私はこれを達成しようとして苦労しています。
button[0].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button[0].setEnabled( false );
if( button[1].isEnabled( false) );
System.out.println("you clicked both buttons");
}
});
button[1].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button[1].setBackground(Color.YELLOW);
button[1].setEnabled( false );
if( buttons[0].isEnabled( false) );
System.out.println("you clicked both buttons");
}
});
次の行でエラーが発生します。
if( buttons[0].isEnabled( false) );
言って
The method isEnabled() in the type Component is not applicable for the arguments (boolean)
私はこれに関して初心者にすぎないので、誰かがこれを行うのを助けたり、別の方法を教えてくれたりするのは素晴らしいことです.