Solved

JTabbedPane - updating data in each tab

Posted on 2000-05-10
2
278 Views
Last Modified: 2011-09-20
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?
0
Comment
Question by:itzikb
2 Comments
 

Expert Comment

by:MoRs
ID: 2799511
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
   }
})
0
 

Accepted Solution

by:
skipper051100 earned 65 total points
ID: 2800202

add a ChangeListener to the JTabbedPane object:


1.make this class implement changeListener
2  register change listener with tabs
    tabs.addChangeListener ( this );
3. implement ChageListener methods - there is one

  public void stateChanged ( ChangeEvent e )
 {
    if ( e.getSource ( ) == tabs ) {
     //call server method
   }
 }
  //probably no need to do a check though
 
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where to store the queries for modification of table 4 61
Windows 10 IE Certificate Issue 10 45
spring jars download 1 26
How to determine if a string is a valid SHA value 7 29
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question