I did a big GUI Based App and I have now many many Action
stuff around there...
I have different Listeneres
, like ActionListener
, KeyAdapters
, ...
Everything should run threaded, so my GUI isnt freezing when do long time operations. So im using SwingWorker
in every ActionListener
...
Currently its working like this: I have my JComponents
, bound on one single ActionListener
. In this Listener
I decide what to do, based on the actionCommand()
. The I call a method, which contains my SwingWorker
and the Action
which should be performed.
Ii dont like this concept anymore, because my class is getting longer and longer and i dont have an overview about all the functionallity. So I decided to do it another way...
I thought Factory Methods would be a great thing, but here is my problem with them: I need sometimes data from my GUI, eg: when pressing JButton
x, what is in JTextField
y and so on...
so what is the best practise for this? Should I just give my Factory a instance of my complete GUI? Or a ArrayList
of Components
? Another problem is that need to change values from my GUI, eg: press button x and then filter a JTable
... how should i do that?
doing it like this = myFactory.process(this);
isnt really that what i want...