K
Kaidi
Hi guys,
I have one question of how to post/hand events under this class
framework:
JFrame A
JPanel B
JPanel C JPanel D .....
JPanel E, Thread F. JPanel G, Thread H. ... ...
Thread F will be called when a button in JPanel E is clicked.
And thread H will be called when a button in JPanel G is clicked.
C,E,F are one one group. D,G,H are another group, etc. As program goes
on, more such groups will be added.
Thread F will update some GUI display things in JPanel E and D and G.
Thread H will also need to update some display things in JPanel G, D.
C.
In other words, each thread needs to update something in ALL other
panels.
Surely, one way is to keep an reference of each of these panels in B
(or frame A) and keep a "parent" reference in each panels to B (or A).
But besides that, is there any better way to use Event to do this? For
example, thread F just posts an event and all other JPanels can get
and process.
Any suggestion or code example are appreciated.
Thanks.
PS: I am kind of new in Java event. I use JBuilder for
button/mouse/JComponents events and the handling functions are
auto-generated by JBuilder.
I have one question of how to post/hand events under this class
framework:
JFrame A
JPanel B
JPanel C JPanel D .....
JPanel E, Thread F. JPanel G, Thread H. ... ...
Thread F will be called when a button in JPanel E is clicked.
And thread H will be called when a button in JPanel G is clicked.
C,E,F are one one group. D,G,H are another group, etc. As program goes
on, more such groups will be added.
Thread F will update some GUI display things in JPanel E and D and G.
Thread H will also need to update some display things in JPanel G, D.
C.
In other words, each thread needs to update something in ALL other
panels.
Surely, one way is to keep an reference of each of these panels in B
(or frame A) and keep a "parent" reference in each panels to B (or A).
But besides that, is there any better way to use Event to do this? For
example, thread F just posts an event and all other JPanels can get
and process.
Any suggestion or code example are appreciated.
Thanks.
PS: I am kind of new in Java event. I use JBuilder for
button/mouse/JComponents events and the handling functions are
auto-generated by JBuilder.