简体   繁体   中英

Java Swing Timers and ActionEvent

I have timer keep running every 1 second.

So right now i have set a variable to show message(msg) every 10sec.

There is button(btn) on msg itself which will show another message(msg2).

So right now is, when i press once, msg2 is showing but the thing is,

the next msg(after 10sec) i don't want the msg2 to be automatically shown without i press btn because right now once i pressed the btn, it will shown for every messages(msg2++).

if(ae.getSource() == btn1)
errorMsg.setVisible(true);

How do i make it only the msg2 appears once i press button for 2nd msg2 and after?

Thank you

好吧,我是个白痴,只需在父类中将errorMsg.setVisible设置为false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM