How to set ToolTips for JList Items

Hello, I'm looking for an example on how to display the entire JList item when my mouse moves onto it. Thanks for all.
[140 byte] By [martinelligegea] at [2007-11-26 13:55:00]
# 1
Override the getLIstCellRenderer(...) method in the ListCellRenderer
watfora at 2007-7-8 1:33:51 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thanks Watfor, for your reply, however, I'm afraid to miss something (certainly because I'm not skilled enough in Java).

I haven't found the getLIstCellRenderer(...) method of ListCellRenderer, but only getLIstCellRendererComponent(...).Even if it was the method name you wanted to tell about, I do not know how to get the JList item text (or index) on which the mouse is located and then set the ToolTipText.If you have a sample to share, I would really appreciate.

Thanks again

Gege

martinelligegea at 2007-7-8 1:33:51 > top of Java-index,Desktop,Core GUI APIs...
# 3

JList list = new JList() {

public String getToolTipText(MouseEvent e) {

int row = locationToIndex(e.getPoint());

return getModel().getElementAt(row).toString();

}

};

Rodney_McKaya at 2007-7-8 1:33:51 > top of Java-index,Desktop,Core GUI APIs...
# 4
Thanks a lot Rodney, It works fine. It was exactly what I was looking for.Have a nice 2007 year.Gege
martinelligegea at 2007-7-8 1:33:51 > top of Java-index,Desktop,Core GUI APIs...