The program below is a GUI hander for a program with the following components. p
ID: 3582638 • Letter: T
Question
The program below is a GUI hander for a program with the following components. private int count = 0; private JLabel label; private JButton button; The handler below is for the botton. Briefly summarize what happens when the user clicks the button. public class ButtonListerner implements ActionListener {public void actionPerformed (ActionEvent e) {count ++; if (count X2 == 0) {contentPame, setBackground(color. red); label. setText ("Go");}} if (count > 10} {button .SetEnabled (false); label, setText ("ARRIVED"); contentpane. setBackground (Color. gray);}}}Explanation / Answer
when click on button every time the count is increament by 1,
initally count is 0,
for button click 1:
count =1;
count is not even then set background as GREEN and label text as GO
for button click 2:
count =2;
count is even then set background as RED and label text as STOP
.
.
.
for button click 9:
count =9;
count is not even then set background as RED and label text as STOP
for button click 10:
count =10;
count is even then set background as GREEN and label text as GO
for button click 11:
count =11;
count is not even then set background as RED and label text as STOP
AND Button is disabled
label text as ARRIVED
set background as GREY
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.