zwraca wartość, gdy wywoływane jest zdarzenie o działaniu JButton

Mam z tym problemJButton zdarzenia akcji, zadeklarowałem zmienną globalną (boolean tc1) i aJButton t1. Po naciśnięciu przycisku JButton muszę zmienić wartość zmiennej boolean na „true”. Czy ktoś może mi pomóc? Mój kod jest tutaj.

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..


    }
}

Dzięki.

questionAnswers(4)

yourAnswerToTheQuestion