This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 18541
    
    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: 18541
    
    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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to load tab content upon clicking the tab in JTabbedPane?
 
Similar Threads
Saving jsp output to a Excel File in different tabs
richfaces tabPanel problem
Hiding / Showing t:div Tomahawk component
How to switch between tabs in swings?
Help with tabbed Panel