English 中文(简体)
单列单中物品的 h盖
原标题:Show box on hover of item in jlist

我想显示一个盒子,在用户对清单中某一项目感到厌恶时包含信息。 如下:

“entergraph

我如何能够这样做? 可见于聊天像假肢或火.。

最佳回答

或许,你是在一种像功能一样的工具之后。 如果是,研究提供诸如“JLabel”等清单CellRenderer部件,并确定“JLabel”的工具。

E.G. of using HTML rendering in a tool tip.

import javax.swing.*;

class LabelWithHtmlTooltip {

    public static void main(String[] args) {
        Runnable r = new Runnable() {
            public void run() {
                String html = "<html><body>" +
                    "<h1>Header</h1>" +
                    "<img src= http://pscode.org/media/starzoom-thumb.gif  " +
                    "width= 160  height= 120 >";
                JLabel label = new JLabel("Point at me!");
                label.setToolTipText(html);
                JOptionPane.showMessageDialog(null, label);
            }
        };
        SwingUtilities.invokeLater(r);
    }
}
问题回答

在这方面,我将努力执行:

添加一名MouseListener和MouseMotionListener给你的JList。 当用户进入名单上时,就开始等待某种拖延(第二段)。 当 mo改或拖拉时,重新开始等待拖延。 当摩擦离开前线时,穿透线。 利用这些听众来追踪模拟立场。

拖延一旦解决(因此,这应意味着 mo留在清单中,而不会全部拖延),那么就使用公共事业。 援引 稍后将显示信息箱。 你们可以利用JList的所在地ToIndex来确定哪一行是 mo。





相关问题
auto abbreviating JLabel

Anyone written a JLabel (extension/util/??) that automatically abbreviates the contents depending on it s preferred/visible size? much appreciated.

how can install swing/matisse on eclipse?

i tried this link: http://downloads.myeclipseide.com/downloads/products/eworkbench/discovery-6.0/ but i m fail how is this?

Java JTextField with input hint

I would like to add a hint value to my javax.swing.JTextField. It should look like Firefox rendering of <input type="text" title="bla">. This creates an edit field with the text bla in the ...

Swing Generator

I need to develop some java gui using swing. A few years ago I did develop a bit with swing. But it was pretty exhausting, you see, back than there weren t much tools to help you. But I do believe ...

Create a ImageIcon that is the mirror of another one

I ll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon. Searching on Google, I found how to do it by using many AWT libraries. Is there a way to do it with ...

热门标签