You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Denis Kishenko (JIRA)" <ji...@apache.org> on 2006/11/27 13:33:23 UTC

[jira] Updated: (HARMONY-2332) [classlib][swing] JList provide wrong tooltip when mouse is over free space

     [ http://issues.apache.org/jira/browse/HARMONY-2332?page=all ]

Denis Kishenko updated HARMONY-2332:
------------------------------------

    Attachment: HARMONY-2332-actual.PNG

Unfortunatelly ALT+PRINT SCREEN doesn't catch cursor, so a red point is cursor position.

> [classlib][swing] JList provide wrong tooltip when mouse is over free space
> ---------------------------------------------------------------------------
>
>                 Key: HARMONY-2332
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2332
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Denis Kishenko
>         Attachments: HARMONY-2332-actual.PNG, HARMONY-2332-expected.PNG
>
>
> JList tooltipping should be:
> - when mouse is over the particular cell region (fine visible when cell is
> selected) then tooltip from its renderer should be tried first
> - when mouse over the free space, not covered by any cell then list tooltip
> should be the preferred one.
> Currently the tooltip from the nearest cell is used. 
> In JList.getToolTipText(MouseEvent) cell identification with locationToIndex()
> should be complemented with getCellBounds() call to determine if mouse is
> really over the cell.
> ========= Test ==============
> import java.awt.Component;
> import javax.swing.JFrame;
> import javax.swing.JLabel;
> import javax.swing.JList;
> import javax.swing.ListCellRenderer;
> public class bug8706 {
>     
>     static class MyRenderer extends JLabel implements ListCellRenderer {
>         public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
>         {
>             setText(value.toString());
>             setToolTipText(value.toString());
>             return this;
>         }
>     }
>     
>     public static void main(String[] args) {
>         JFrame f = new JFrame();
>         JList l = new JList(new Object[] {"red", "yellow", "green", "blue"});        
>         l.setToolTipText("this is tooltip");
>         l.setCellRenderer(new MyRenderer());          
>         f.getContentPane().add(l);        
>         f.setSize(150, 150);
>         f.setVisible(true);
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira