static « Event « Java Swing Q&A





1. Problem whit ActionListener and static variable    coderanch.com

I am not sure I get your problem, but here is a suggestion anyway... My guess is that VARIABLE is declared as static String VARIABLE; I would suggest that you try one of these two: static volatile String VARAIBLE; and leave the rest as it is. or, leave the declaration as it is and: synchronized(VARIABLE) { JLabel lab = ...

2. ActionListener: Non-static variable 'this' cannot be referenced from a non-static context????    coderanch.com

Hi guys! I'm not sure why the below code is giving me the error message: 'non-static variable this cannot be referenced from a non-static context', which points to tl, my TimerListener, which implements ActionListener. Is 'this' implied somewhere there that I'm not seeing? I'm not sure what 'this' would have to do with my TimerListener??? I've Googled extensively and can't really ...