Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTabbedPane - MouseEvents on tabs

843805Dec 30 2006 — edited Dec 31 2006
I'm trying to find some way to add MouseListeners to tabs on a JTabbedPane. I can easily add them, of course, to the components denoted by the tabs, but I need them listening for MouseEvents on the actual buttons that switch tabs themselves.

So far, the only method I can think of is adding the listener to the whole JTabbedPane. If the event isn't within the currently focused component, then it must be in one of the tabs, so I compare the tooltip for that point against the tooltip of the current tab, but this won't work properly if more than one tab has the same tooltip. Anyone have any better ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 28 2007
Added on Dec 30 2006
2 comments
94 views