|
|
Re: Updating JLabel shows the preious text behind.
|
Posted: Mar 23, 2005 11:26 PM
|
|
Amol's solution is right.
But you surely want to know why your solution doesn't work, right?
The reason is, that jLabel8 is not a label, but a reference to a label
What happened?
1.) jLabel8 = new JLabel("text1);
This creates a new Label, let's call it labelA and puts a reference to it into jLabel8.
2.) zoomPanel.add(jLabel8);
This adds labelA to zoomPanel
3.) jLabel8 = new JLabel("text2);
This creates a new Label, let's call it labelB and puts a reference to it into jLabel8. But labelA is not affected by this operation.
4.) zoomPanel.add(jLabel8);
This adds labelB to zoomPanel. labelA still remains in zoomPanel.
|
|