I need to catch whether the user has (left) clicked on the currently selected tab of a TabbedComponent. Am I missing anything obvious?
currentTabChanged doesn’t help as it only triggers when the tab is changed, not when the current tab is clicked on, and popupMenuClickOnTab only reacts to right-clicks.
I’ve got a solution in place at the moment by attaching the parent component (the one which inherits from TabbedComponent) as a MouseListener to to the TabbedButtonBar and checking screen coordinates but it feels super clunky!
Yes I’m overriding that in the class that’s acting as the MouseListener for the TabbedButtonBar, but assumed I couldn’t get at mouseDown for each of the individual buttons.
I see that the TabbedButtonBar has a createTabButton function that can be overridden. I guess I could just use a class derived from TabbedButtonBar as a member of my parent class rather than having it derive from TabbedComponent, though maybe this just changes the issue rather than being a more elegant solution.
You can have a pointer to your TabbedComponent as a variable in each of your tab components… on mouseDown() you can either call a method in the TabbedComponent… or make it a ChangeListener… then in mouseDown() send a ChangeBroadcaster changeMessage to your TabbedComponent.
Ah I think we might be talking about different things. Are you talking about the content components that are shown/hidden when a tab is clicked on? When I said ‘currently selected tab’ I’d been meaning the button in the TabbedButtonBar.