• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't trigger the ChangeListener  RSS feed

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this method, I tried to select the currently selected panel, then select the index 0 JPanel
and re-select the current one to simulate the ChangeListener event,
However, when the user comes back from a JDialog, I don't have this opportunity to do so,
How do I trigger the ChangeListener of the tabbedPane (JTabbedPane) conveniently?
Thanks
Jack

 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I completely understand what it is you're trying to accomplish or why, but it seems like you could add a WindowListener to the JDialog which in the windowClosed() method uses a reference to the JTabbedPane to retrieve all its associated ChangeListeners via the getChangeListeners() method. You could then simply invoke each of the stateChanged() methods with your own ChangeEvent.

I'm still a bit puzzled as to why you would want to fire a ChangeEvent if the tab selection wasn't changed, though.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!