harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-2332) [classlib][swing] JList provide wrong tooltip when mouse is over free space
Date Mon, 27 Nov 2006 12:47:22 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-2332?page=all ]

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

    Description: 
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 Test {
    
    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);
    }
}


  was:
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);
    }
}



> [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 Test {
>     
>     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

        

Mime
View raw message