I have been working on a program to store Records on students in Java. If I try to create a Record, the first one works exactly as planned. However, when I try to create the second one, only the Checkbox appears, and it will disappear and reappear randomly while resizing the window.
Here is the code for creating a new Record:
JLabel[] DateRecord = new JLabel[99];
JLabel[] NameRecord = new JLabel[99];
JLabel[] ReasonRecord = new JLabel[99];
JCheckBox[] ConfirmedRecord = new JCheckBox[99];
JPanel[] Records = new JPanel[99];
int CurrentRecord = i++;
int Currenty = CurrentRecord*50;
Records[CurrentRecord] = new JPanel();
DateRecord[CurrentRecord] = new JLabel(date);
NameRecord[CurrentRecord] = new JLabel(name);
ReasonRecord[CurrentRecord] = new JLabel(reason);
ConfirmedRecord[CurrentRecord] = new JCheckBox();
ConfirmedRecord[CurrentRecord].setEnabled(true);
Records[CurrentRecord].setLayout(null);
int reasonlength = reason.length() * 3;
DateRecord[CurrentRecord].setBounds(80, 0, 200, 50);
NameRecord[CurrentRecord].setBounds(270, 0, 200, 50);
ReasonRecord[CurrentRecord].setBounds(770 - reasonlength, 0, 400, 50);
ConfirmedRecord[CurrentRecord].setBounds(1220, 13, 25, 50);
Records[CurrentRecord].add(DateRecord[CurrentRecord]);
Records[CurrentRecord].add(NameRecord[CurrentRecord]);
Records[CurrentRecord].add(ReasonRecord[CurrentRecord]);
Records[CurrentRecord].add(ConfirmedRecord[CurrentRecord]);
Records[CurrentRecord].setBounds(0, Currenty, (int) ((int) GUI.screenSize.width / 1.215), (int) GUI.screenSize.height - 113);
GUI.TablePanel.setLayout(null);
GUI.TablePanel.add(Records[CurrentRecord]);
GUI.TablePanel.repaint();
GUI.frame.repaint();
I have search the web, but found nothing. Any help would be appreciated!
PS: I am using Java 7
-Qo2770