********************************************************************
COMPLETE SOURCE CODE FOR : ToolTipText.java
********************************************************************
import javax.swing.JFrame;
import javax.swing.JButton;
public class ToolTipText
{
public static void main(String[]args)
{
//Create a button with text ( Hover on me and don't move )
JButton button=new JButton("Hover on me and don't move");
//SET TOOL TIP TEXT TO THE BUTTON
//Text : I am tool tip text
button.setToolTipText("I am tool tip text");
//Create a JFrame with title ( Tool tip text )
JFrame frame=new JFrame("Tool tip text");
//Add created button into JFrame
frame.add(button);
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size
frame.setSize(250,65);
//Make JFrame visible
frame.setVisible(true);
}
}
********************************************************************
JUST COMPILE AND EXECUTE IT
********************************************************************