5.2 JApplet and JToolTip Class
JApplet Class
JApplet is swing version of Applet class.
JApplet can use all the Swing components.
JApplet is a container and we can add GUI components on it and handle the events.
The javax.swing.JApplet
class defines the core functionality of an applet.
Applet Code is run inside a web browser and is embedded in html code.
The browser provides everything the applet needs through an applet context—the API the applet uses to interact with its environment.<
applet
code
=
"AnalogClock"
width
=
"100"
height
=
"100"
></
applet
>
Differences between Applet and JApplet
Sr. No. | Applet | JApplet |
---|---|---|
1 | AWT Component | Swing Component |
2 | Heavy-weight | Light-weight |
3 | Classic Look and Feel | Better Look and Feel |
4 | derived from java.applet.* | derived from javax.swing.* |
5 |
JApplet Class Hierarchy

JToolTip Class
Tooltip - Text which pops up when mouse rests over a component. Provide instant help to user.
Used to display a "Tip" for a Component.
Swing component can use the JComponent
setToolTipText( )
method to specify the text for a standard tooltip.
A component that wants to create a custom ToolTip
display can override JComponent
's createToolTip
method and use a subclass of this class.
Return Type | Method
String | getTipText() Returns the text that is shown when the tool tip is displayed. |
void | setTipText(String tipText) Sets the text to show when the tool tip is displayed. |
