How to make button click block in Java Swing? -


i new swing.

i have

itemactionbutton.addactionlistener(new actionlistener() {     @override     public void actionperformed(actionevent arg) {         itemaction();     } }); 

but when button clicked, instead of running action on thread, parent's form's thread wait until action completed before refreshing, allowing additional clicks, etc.

how can this?

code in actionlistener executes on edt, prevents gui repainting , responding other events.

if have long running task , don't want block edt need use thread.

read section swing tutorial on concurrency more information , solution using swingworker.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -