Reputation: 175
When mouse enter on any button without toolTip, appears black dot (like a corner of tooltip). It is really odd and I don't know what to do with it :/ I generated my project by netbeans -> java desktop application. I never setted toolTipText in this buttons so they are default empty. Any idea?
edit: When I wrote that it's empty I mean that it's nothing in properties of JButton toolTip. Generated code:
lottery.setAction(actionMap.get("lotteryStart")); // NOI18N
lottery.setText(resourceMap.getString("lottery.text")); // NOI18N
lottery.setName("lottery"); // NOI18N
programView.properties:
lottery.text=Start
Upvotes: 2
Views: 999
Reputation: 33
This is old, but actually a netbeans issue, and should be fixed. Still, not fixed.
Netbeans keeps setting the tooltips to "" instead of null. Even if they are set to null in text, next time UI design of netbeans is opened, it sets them to "" again.
Upvotes: 0
Reputation: 7943
I agree with @jfpoilpret the problem is not NetBeans related. The problem is the tooltip not being, as @camickr said, default, i.e. null. You must be setting it to "" empty String somewhere. Set it to null and the problem is sorted.
The sample code below presents the problem. One button has tooltip null (as println proves this is the default one) the other one has "" (empty String).
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class ToolTipTest
{
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
JPanel p = new JPanel();
JButton b1 = new JButton("My tooltip is null");
System.out.println("default tooltip is b1.getToolTipText()="+b1.getToolTipText());
b1.setToolTipText(null);
p.add(b1);
JButton b2 = new JButton("My tooltip is\"\"");
b2.setToolTipText("");
p.add(b2);
JFrame f = new JFrame();
f.setContentPane(p);
f.setSize(400, 300);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
});
}
}
Upvotes: 2