-
JLabel question
Is there any reason you can't use a JLabel more than once in the same JPanel? I can't seem to. For example:
JLabel testLabel = new JLabel("T");
testLabel.setForeground(Color.black);
testLabel.setFont(stdFont);
this.add(testLabel);
//I add a JTextField here
this.add(testLabel);
//I add a JTextField here
this.add(testLabel);
doesn't work. Only the last added JLabel will appear. Does anyone know a way around this?
"There's nothing more dangerous than a resourceful idiot." ---Dilbert
-
Re: JLabel question
make a second jLabel
"There are no facts, only interpretations."
-Friedrich Nietzsche
-
Re: JLabel question
I just realized that I didn't give you any explaination..
You'll need a different JLabel for each label you put on the GUI. It is because each item on the GUI is an object w/ specific properties (such as size, position on screen, etc.) And you can't have one object in more than one place at any time.. that is why you need to have the extra jLabels, even if they say the same thing
"There are no facts, only interpretations."
-Friedrich Nietzsche