Link to home
Start Free TrialLog in
Avatar of itzikb
itzikb

asked on

JTabbedPane - updating data in each tab

i'm working on a newsgroups application , using a server and a client.
on the client side i use JTabbedPane.
each Tab has some option : like displaying the groups in a list ,delete a list etc..
i want to updated the data of a tab each time the user clicks the tab(by calling a method connect to the server.
how di i do that?
Avatar of MoRs
MoRs
Flag of Lithuania image

Hi, get the model of your TabbedPane by calling getModel() method, then register ChangeListener to this model. Code would like smth like this:

JTabbedPane tabs = new JTabbedPane();
//form your tabs
tabs.getModel().addChangeListener(new ChangeListener()
{
   public void stateChanged(ChangeEvent e)
   {
      //do smth what you need
   }
})
ASKER CERTIFIED SOLUTION
Avatar of skipper051100
skipper051100

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial