When I have buttons near the button of the screen, the tooltip appears underneath the mouse. Clicking will then make the tooltip disappear, instead of clicking the button.
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();
}
Any idea how to ensure that the button receives the click in this case?