Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JTabbedPane listeners

Status
Not open for further replies.

riches85

Programmer
Nov 13, 2002
59
US
I am developing a GUI in swing that has a JTabbedPane with several tabs. I have written a custom FocusListener to do some work when the TabbedPane gains focus, but nothing happens when you go on to select different tabs. I have sice tried to add a Changelistener to the JTabbed paing to keep track of the state of the tabs, but it seems to be a little buggy when I try to get a reference to the component inside. Does anyone know of a good way to add a listener that would accept events fired when a user changes tabs that would allow me to get a reference to the component inside the tab?
 
I did read that page, but it did little to help me in my situation. This is what I am trying to do. I want the application to use a voice synthesizer to speak the name of the tab that has gained focus. I have created a focus Listener that does this when I Tab between the components of the GUI, but since all of the tabs in a JTabbedPane are considered part of the JTabbedPane itself, focus is never changed as you tab between its elements. Like I said before, I used a ChangeListener before, but it seemed to be a bit buggy. I was just asking for any suggestions from someone with a little more experience with JTabbedPanes.
 
I've successfully used ChangeListeners to detect when the user has moved to a new tab. I'm curious as to what you've found to be buggy about it.

Are you trying to access a component on the tabbed pane to get the name of the pane, or are you trying to access the tabbed pane itself to get the name?

Post some details about the buggy aspect of it - maybe some code too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top