Java 将工具提示管理器的DismissDelay设置为零
我为按钮工具提示设置了dismissdelay“0”。在windows中我看不到工具提示,但在linux中我可以看到工具提示。在javax.swing.ToolTipManager的java源代码中,我没有找到任何与平台相关的信息 有人知道吗Java 将工具提示管理器的DismissDelay设置为零,java,swing,tooltip,Java,Swing,Tooltip,我为按钮工具提示设置了dismissdelay“0”。在windows中我看不到工具提示,但在linux中我可以看到工具提示。在javax.swing.ToolTipManager的java源代码中,我没有找到任何与平台相关的信息 有人知道吗 public class TooltipInSwing extends JFrame { public TooltipInSwing() { super("TooltipInSwing"); setSize(400,
public class TooltipInSwing extends JFrame {
public TooltipInSwing() {
super("TooltipInSwing");
setSize(400, 300);
getContentPane().setLayout(new FlowLayout());
JButton b1 = new JButton("Simple tooltip 1");
b1.setToolTipText("simple tool tip without a dismiss delay" + ToolTipManager.sharedInstance().getInitialDelay());
// set a new dismiss delay to a really big value, default is 4 sec.
ToolTipManager.sharedInstance().setDismissDelay(0);
getContentPane().add(b1);
WindowListener wndCloser = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
};
addWindowListener(wndCloser);
setVisible(true);
}
public static void main(String args[]) {
new TooltipInSwing();
}
}
这个问题的重点是什么?可能会有不同的行为,但为什么您希望解雇延迟为0?这意味着永远不应显示工具提示。如果这是您想要的,则将工具提示文本设置为null,工具提示将不会显示。否则,你想解决什么问题?@camickr谢谢你的回复。我无意中看到了这种行为,然后我想这背后可能有一些真正的原因。我自己试了一下,但没能找到。这就是问题的原因