Java JButton set tooltip text
import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; public class Main extends JFrame { public Main() { super("JButton"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); JButton bn = new JButton("Close"); bn.setToolTipText("Click this button to ..."); getContentPane().add(bn);/*from www. j av a 2 s. c o m*/ } public static void main(String[] args) { Main frame = new Main(); frame.pack(); frame.setVisible(true); } }