How to make action on each word in the label?

I have a label in the frame I want to make mouse event if the user click on the first word . and onther action if he pressed on the word and so on?I make mouseListener but I do not how to implement this thing.This is the code.

import java.awt.event.*;

import java.awt.*;

import javax.swing.*;

public class TestLinkedLabel extends JFrame implements MouseMotionListener,MouseListener

{

static TestLinkedLabel ob;

JLabel l;

public TestLinkedLabel()

{

setLayout(new FlowLayout());

l=new JLabel("<html><u>Click me to open link</u></html>");

l.addMouseListener(this);

l.addMouseMotionListener(this);

add(l);

l.setForeground(Color.blue);

setSize(400,300);

setVisible(true);

}

public void mouseMoved(MouseEvent e){}

public void mouseDragged(MouseEvent e){}

public void mousePressed(MouseEvent e){}

public void mouseClicked(MouseEvent e){}

public void mouseEntered(MouseEvent e)

{

l.setCursor(new Cursor(12));

}

public void mouseReleased(MouseEvent e){}

public void mouseExited(MouseEvent e)

{

l.setCursor(new Cursor(0));

}

public static void main(String s[])

{

ob=new TestLinkedLabel();

}

}

[1329 byte] By [haroonfoada] at [2007-10-1 13:13:25]
# 1
Uhm...I'd rather use multiple JLabels, enclosed in a JPanel, with a suitable Layout Manager.But maybe there's an easy way...
DeK...Delirium_et_Kaosa at 2007-7-10 16:01:19 > top of Java-index,Other Topics,Algorithms...