Problem with tooltip

Hi,I used JLabel in applet. Here what my proplem is ....... I would like to add tooltip to JLabel ..... but i didn't get it.I tried as label.setToolTipText(" tool tip ");Is it right or not ?Can add tool tip to labels in applet?Thanks in
[300 byte] By [p.v.k.ka] at [2007-10-3 2:50:18]
# 1
> I tried as label.setToolTipText(" tool tip ");> Is it right or not ?It is correct.
CeciNEstPasUnProgrammeura at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 2
but it is not working in applet.is tooltip's worked in applet?
p.v.k.ka at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 3
> but it is not working in applet.> is tooltip's worked in applet?It shouldn't matter whether it's an applet or not. Show your code please. And by the way, how do you test it? Appletviewer?
CeciNEstPasUnProgrammeura at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 4

Hi,

i used labes in tree. Please check it and give reply.

Here i used three labels i need tooltip for "lab2". How can i get it?

tree.setCellRenderer(new DefaultTreeCellRenderer()

{

public Component getTreeCellRendererComponent(JTree tree, Object value,

boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)

{

if(leaf && !territories.containsKey(value.toString()) && !value.toString().equals(root.toString()))

{

TreeNode chaild = (TreeNode)value;

TreeNode parent = chaild.getParent();

int ind = parent.getIndex(chaild) + 1;

String status = accountStatus[root.getIndex(parent)].get(value.toString());

String val = value.toString();

JLabel label = new JLabel();

exactly(label, 530, 25);

label.setLayout(new FlowLayout());

JLabel lab1 = new JLabel("#"+ind);

exactly(lab1, 50 ,25);

label.add(lab1);

JLabel lab2 = new JLabel(""+val);

exactly(lab2, 300, 25);

label.add(lab2);

JLabel lab3 = new JLabel(""+status);

exactly(lab3, 150, 25);

label.add(lab3);

return label;

}

else

return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

}

});

Thanks,

Kiran

p.v.k.ka at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 5
Crosspost http://forum.java.sun.com/thread.jspa?messageID=4342306
PhHeina at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 6
I'm testing in NetBeans IDE.
p.v.k.ka at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 7
http://forum.java.sun.com/help.jspa?sec=formattingAnd please test again in a real browser. I don't trust appletviewer or any IDE to do the correct thing.
CeciNEstPasUnProgrammeura at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 8
Firstly adding labels to a label seems funny. And secondly you don't seem to have registered your tree with the ToolTipManager.
PhHeina at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 9
Thanks CeciNEstPasUnProgrammeur ,I clarify my doubt. Applet can accept tooltips . But i my program didn't get it.I used trees , there are i added tool tips . They didn't work.-Kiran
p.v.k.ka at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...
# 10

> Thanks CeciNEstPasUnProgrammeur ,

> I clarify my doubt. Applet can accept tooltips .

Yes.

> But i my program didn't get it.

I suppose.

> used trees , there are i added tool tips . They

> didn't work.

Did you notice how you didn't mention that at all in the beginning? See Phil's advise.

CeciNEstPasUnProgrammeura at 2007-7-14 20:39:08 > top of Java-index,Java Essentials,Java Programming...