Problem with actions & swing

A

Allan Valeriano

Hi, I'm having a little problem with swing components and actions.
I have 1 action which is shared by 2 swing components (1 menu and 1
popUpMenu). Both of them work over a Tree to do something when a node
is selected.
The problem is that the popUpMenu is getting messed up when I select a
tree node while the menu is working fine, so when I select a node, the
menu is available, but the popUpMenu isn't.
Does anybody knows why is it happening? Maybe 2 swing components
cannot use the same action...

thanks in advance
Allan Valeriano
 
D

Daniel Pitts

Hi, I'm having a little problem with swing components and actions.
I have 1 action which is shared by 2 swing components (1 menu and 1
popUpMenu). Both of them work over a Tree to do something when a node
is selected.
The problem is that the popUpMenu is getting messed up when I select a
tree node while the menu is working fine, so when I select a node, the
menu is available, but the popUpMenu isn't.
Does anybody knows why is it happening? Maybe 2 swing components
cannot use the same action...

thanks in advance
Allan Valeriano

The only advice I can give without you providing an sscce (Andrew
provides you a link):

Make sure you're following the Swing "Single Thread" policy and only
modifying your action from within the EDT, eg with
SwingUtilities.invokeLater().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top