This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Using repaint() in JFrame
Posted by Arun J Martin on July 23, 2001 at 2:25 PM
I have a class MainClass which has got 2 JTabbedPanes which are 2 JPanels ie P1,P2.
In P1,I get some user values thru some JTextFields and insert into the database. Then next Panel P2 is used for modifiying the P1's values.
In P2,the values are retreived from the database and put in a JComboBox which is used for further manipulation.
The problem is that whenever I insert values into P1,the new values don't get immediately updated in P2. I have to quit the application and run the application once again. This defeats the very purpose of my app. I want that P2 should reflect my new values immediately when they are inserted into database thru P1.
The outline pgm code
public class MainClass extends JFrame implements ChangeListener
// Declare 2 Tabbed Panes.
// add Listener
// add tabbedpane to the container.
// Listener method
if (selected index = 0)
if (selected index = 1)
public static void main()
} // end of MainClass
class p1 extends JPanel implements ActionListener
// declare the textfields,button and add to the
// add Action Listener
// get the text field value
// insert into the database
} // end of class p1
class p2 extends JPanel implements ActionListener
JComboBox jcbox tf;
// get the values from the database
// put into the combobox.
// the pblm ie the latest values are not being displayed
// get the values from the combo box for processing
} // end of class p2
with warm regards,