aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to load tab content upon clicking the tab in JTabbedPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to load tab content upon clicking the tab in JTabbedPane?" Watch "How to load tab content upon clicking the tab in JTabbedPane?" New topic
Author

How to load tab content upon clicking the tab in JTabbedPane?

nagendra bvvs
Greenhorn

Joined: Dec 20, 2007
Posts: 3
Hi All,

Could you please help me in this?

Requirement:
I would like to load content of a tab once after user clicks on particular tab in JTabbedPan. (Based on tab selection).
Do we have onclick event on tab (in JTabbedPan)?

Eg: My JTabbedPan contains tabs Tab1,Tab2,Tab3.
So, if user clicks on tab2 it starts loading the tab and adds component to tab2. simillarly for tab1 and tab3.

Is this possible??? If so kindly help/guide me. (Any related information or article is most welcome).

Thanks in advance.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

"Based on tab selection"... does that mean you are actually interested in when a tab is selected? In that case just add a ChangeListener to the JTabbedPane and it will be notified whenever a new tab is selected.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

"nagenda bvvs", please check your private messages regarding an important administrative matter.

Thank you.
nagendra bvvs
Greenhorn

Joined: Dec 20, 2007
Posts: 3
Thanks all.
ChangeListener has gave solution for my requirement.

Thank you so much.
 
jQuery in Action, 2nd edition
 
subject: How to load tab content upon clicking the tab in JTabbedPane?