Tool tips
The previous example added a “tool tip” to the button. Almost all of the classes that you’ll be using to create your user interfaces are derived from JComponent, which contains a method called setToolTipText(String). So, for virtually anything you place on your form, all you need to do is say (for an object jc of any JComponent-derived class):
jc.setToolTipText("My tip");
and when the mouse stays over that JComponent for a predetermined period of time, a tiny box containing your text will pop up next to the mouse.