|
|
GUI Changes: The AWT Grows Up |
Creating a tool tip for anyJComponentis easy. You just use thesetToolTipTextmethod to set up a tool tip for the component. For example, to add tool tips to the three buttons in theButtonDemoprogram (explained in How to Use Buttons), you add only three lines of code:When the user of the program pauses with the cursor over any of the program's buttons, the tool tip for the button comes up. For example:b1.setToolTipText("Click this button to disable the middle button."); b2.setToolTipText("This middle button does nothing when you click it."); b3.setToolTipText("Click this button to enable the middle button.");
![]()
[Please imagine a cursor over the left button. Thank you.]For more information about tool tips, read the documentation for the
JToolTipand
JComponentclasses.
|
|
GUI Changes: The AWT Grows Up |