возвращать значение при вызове события JButton actionperformed
У меня есть проблемы сJButton
события действия, я объявил глобальную переменную (boolean tc1
) иJButton t1
, Когда я нажимаю JButton, мне нужно изменить значение логической переменной на «true». Может кто-нибудь мне помочь? Мой код идет сюда.
class Tracker extends JPanel {
public static void main(String[] args) {
new Tracker();
}
public Tracker() {
JButton tr=new JButton("TRACKER APPLET");
JButton rf=new JButton("REFRESH");
boolean tc1=false,tc2=false,tc3=false,tc4=false;
JButton t1=new JButton(" ");
t1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
tc1=true;
}
});
System.out.println(tc1);
//remaining part of the code...
// here i need to use the value of tc1 for further process..
}
}
Благодарю.