Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Tool tip text (Java)

Tool tip text is a description about a component. For example, about a button in a graphical user interface. A tool tip text will appear when you hover and stop for certain time on the button.

********************************************************************
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
********************************************************************