1
当我在屏幕按钮附近有按钮时,工具提示出现在鼠标下方。点击会使工具提示消失,而不是点击按钮。工具提示窃取鼠标事件
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
JButton button = new JButton("Test");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("action performed");
}
});
button.setToolTipText("Sample tooltip text");
frame.add(button);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.pack();
}
任何想法如何确保按钮接收在这种情况下,点击?