Source Code : Modify the behaviour of the default JToolTip
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Modify the behaviour of the default JToolTip
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Point;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JToolTip;
public class Main {
public static void main(String args[]) {
JFrame frame = new JFrame("JToolTip Sample");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton b1 = new JButton("Button 1") {
public JToolTip createToolTip() {
JToolTip tip = super.createToolTip();
tip.setForeground(Color.YELLOW);
return tip;
}
public Point getToolTipLocation(MouseEvent event) {
return new Point((event.getX() + 100), (event.getY() + 100));
}
};
b1.setToolTipText("HELLO");
frame.add(b1, BorderLayout.NORTH);
frame.setSize(300, 150);
frame.setVisible(true);
}
}
Thank with us