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] Created: (HARMONY-2332) [classlib][swing] JList provide wrong tooltip when mouse is over free space
Date Mon, 27 Nov 2006 12:29:21 GMT
[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

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)
            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.setSize(150, 150);

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


View raw message