|
-
October 4th, 2000, 01:29 PM
#1
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
BWAHAHAHAHAHAHA! ---Murray
-
October 4th, 2000, 03:57 PM
#2
Re: JLabel question
make a second jLabel
"There are no facts, only interpretations."
-Friedrich Nietzsche
-
October 4th, 2000, 04:04 PM
#3
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|