Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTabbedPane listener for: add, close and change selected tab

 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What listener should I add to JTabbedPane, so I can "follow": opening new tab, closing tab, and changing selected tab?
 
pete stein
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you add a ChangeListener to the JTabbedPane's SingleSelectionModel (obtained via getModel()), you can listen for selection changes. I think that to listen for addition and removal of tabs / components, you'll want to add a ComponentListener to the JTabbedPane, though I'm not 100% sure if this is the only or best way to do this.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic