I've been looking everywhere online but I have found no answers to this little problem. In Windows 7 (and in Vista, I think,) you have a nice rounded silver looking tooltip that looks way better than the old yellow boxed crappy looking one. The "How do I make a Windows 7 Tooltip in Java - Stack Overflow" tip below is how it appears.
So in Java, I want to do exactly that, make the nice new Windows tooltip. The problem is I don't know how to.
Outside of the following simple code is a main method that simply creates an object of this class 'Tooltip'.
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class Tooltip extends JFrame {
public Tooltip() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
setLayout(new FlowLayout());
JButton button = new JButton("Tooltip Button");
button.setToolTipText("Tooltip");
add(button);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(250, 160);
}
}
As you can see in the try/multi catch, I set the Look and Feel to the operating system that the program is currently running on. If I were to run this program on Windows, I would get the crummy yellow tooltip.
So what changes do I have to make to the code so that I will get a nice silver tooltip if the program is running on a Windows operating system?