confused on jpanel

S

steve

i have a jpanel

public class SupContactDetails extends JPanel {
static final int EXEPTION_ERROR = -1;
static final int USER_ERROR = -2;
private personDet contact1 = new personDet();
private personDet contact2 = new personDet();
private personDet contact3 = new personDet();
private personDet contact4 = new personDet();
private personDet contact5 = new personDet();
private personDet contact6 = new personDet();
private JTabbedPane supcntWindow = new JTabbedPane();
private JButton ClearContact_BUTT = new JButton();

as far as i can see this creates 6 "objects of personDet" contact1-6

I then add these to the jpanel, as a j tabbedpane


supcntWindow.addTab("Contact1", contact1);
supcntWindow.addTab("Contact2", contact2);
supcntWindow.addTab("Contact3", contact3);
supcntWindow.addTab("Contact4", contact4);
supcntWindow.addTab("Q.A Contact1", contact5);
supcntWindow.addTab("Q.A Contact2", contact6);
this.add(ClearContact_BUTT, null); //this will show for all tabs
this.add(supcntWindow, null);


now i thought that if personDet contained the following code

public void UpdateUi(String[] CurrentRecordDetails) {
Salutation.setSelectedItem(CurrentRecordDetails[0]);
givenNames.setText(CurrentRecordDetails[1]);
familyName.setText(CurrentRecordDetails[2]);
EmailPersonal.setText(CurrentRecordDetails[3]);
otherDetails.setText(CurrentRecordDetails[4]);

// otherDetails.updateUI();
}


then a call such as

contact1.UpdateUi(contdet);
contact2.UpdateUi(contdet);
contact3.UpdateUi(contdet);
should update the private contents, in each of the personDet objects

but tracing the code, what is actually happening , is that contact1, is
getting updated with contact1-3, data , BUT if I flip the tabs , it
shows the correct data on the screen., but if i do not flip the tabs then
contact1, shows the data from the last tab stored.

andi if i get the data back from each of the tabs , it is correct, but it
shows different results on screen UNTIL each of the tabs has been clicked on.

this is on java 4.1.2 on all platforms.
any ideas?

steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,328
Latest member
66Teonna9

Latest Threads

Top