Not able to display Tooltip text

[nobr]Hi, I want to display a Tooltip text when mouse is moved to particular location.

I have used following approach to implement it:

I have JPanel inside the applet. Panel contain one method called createLabel() which set the tooltip text using JLabel. It will be called on mouseMoved Event. But it doesn't show a tooltip text.

Code:

TestApplet.java :

public TestAppletextends JApplet{

QuadPanel quadPanel =null;

publicvoid init(){

quadPanel =new QuadPanel(this );

getContentPane().add(quadPanel);

}

}

QuadPanel.java

publicclass QuadPanelextends JPanelimplements MouseListener,MouseMotionListener

{

public QuadPanel( JApplet enclosingApplet )

{

enclosingContainer = enclosingApplet;

setBackground(Color.white);

setLocation(100,200);

addMouseMotionListener(this);

addMouseListener(this);

}

publicvoid update(Graphics g)

{

//contains business logic to dispaly data.

}

publicvoid paintComponent(Graphics g)

{

super.paintComponent(g);

update(g);

}

publicvoid mouseMoved(MouseEvent e){

if((e.getX() > 200 && e.getX() < 212) && (e.getY() > 75 && e.getY() < 85)){

createLabel();

repaint()

}

}

publicvoid createLabel(){

StringBuffer buff =new StringBuffer();

buff.append("<html>");

buff.append("<body bgcolor=white>");

buff.append("<b>Title</b><br>");

buff.append("Test 1 <br>");

buff.append("Test 2<br>");

buff.append("</body>");

buff.append("</html>");

ToolTipManager.sharedInstance().setInitialDelay(0);

l.setToolTipText(buff.toString());

}

}

I don't know what is the problem?

Please guide me.

Thanks

Chintan[/nobr]

[3432 byte] By [chintan_34a] at [2007-11-26 15:21:15]
# 1
What is "l" ...?
itchyscratchya at 2007-7-8 11:50:18 > top of Java-index,Desktop,Core GUI APIs...
# 2
l is JLabel. Sorry, I forgot to mention. JLabel l = new JLabel("test");
chintan_34a at 2007-7-8 11:50:18 > top of Java-index,Desktop,Core GUI APIs...