import javax.swing.JButton; import javax.swing.JComponent; public class Main { public static void main(String[] argv) throws Exception { JComponent button = new JButton("Label"); // Set tool tip text button.setToolTipText("tool tip text"); } }