You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/03/14 15:34:10 UTC
[jira] Updated: (HARMONY-2332) [classlib][swing] JList provide
wrong tooltip when mouse is over free space
[ https://issues.apache.org/jira/browse/HARMONY-2332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexei Zakharov updated HARMONY-2332:
-------------------------------------
Priority: Minor (was: Major)
> [classlib][swing] JList provide wrong tooltip when mouse is over free space
> ---------------------------------------------------------------------------
>
> Key: HARMONY-2332
> URL: https://issues.apache.org/jira/browse/HARMONY-2332
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
> Priority: Minor
> 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.
-
You can reply to this email to add a comment to the issue online.