change the caption of a label

Assume in my program i have 2 labels called jLabel 1 and jLabel 2.Once i click on jLabel 1 i need to change the caption of jLabel 2.Can some one help me. Thanks
[181 byte] By [jolaa] at [2007-10-3 3:32:36]
# 1
jlabel2.setText(newText)?
CeciNEstPasUnProgrammeura at 2007-7-14 21:26:52 > top of Java-index,Java Essentials,Java Programming...
# 2
Here i have several labels. label 1,2,3,4. I click only on label 1,2,3 and label 4 dispaly message according the label i press.
jolaa at 2007-7-14 21:26:52 > top of Java-index,Java Essentials,Java Programming...
# 3
> Here i have several labels. label 1,2,3,4. I click> only on label 1,2,3 and > label 4 dispaly message according the label i press.public void actionPerformed(ActionEvent e) {lable4.setText( e.getSource().getText());}
Mani_csa at 2007-7-14 21:26:52 > top of Java-index,Java Essentials,Java Programming...
# 4
>lable4.setText( e.getSource().getText());Though you most likely have to revalidate the container for the change to show.
CeciNEstPasUnProgrammeura at 2007-7-14 21:26:52 > top of Java-index,Java Essentials,Java Programming...
# 5

> public void actionPerformed(ActionEvent e)

labels don't support ActionListeners. You will need to use a MouseListener and handle the mouseClicked() event.

> Though you most likely have to revalidate the container for the change to show.

When you change a property of the component it will repaint itself. You only use revalidate() when you add or remove a component from a container.

camickra at 2007-7-14 21:26:52 > top of Java-index,Java Essentials,Java Programming...