You are here:   HomeJava ProgrammingSwingBoxLayout Example Program
by Dinesh Thakur Category: Swing

JToolTip: Consists of a help tab that arises after one second on the position pointed to by the cursor. Normally it is not necessary to use JToolTip class directly, can be set to any component window by: e.setToolTipText ("This is the label").

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class JavaExamleTooltipInJApplet extends JApplet
   {
     JButton BtnPrs = new JButton("Press Here");
     JTextField Txt = new JTextField(20);
     public void init()
        {
           Container Cntnr = getContentPane();
           Cntnr.setLayout(new FlowLayout());
           BtnPrs.setToolTipText("That is a Button.");
           Cntnr.add(BtnPrs);
           Cntnr.add(Txt);
           BtnPrs.addActionListener(new ActionListener()
              {
                 public void actionPerformed(ActionEvent e)
                  {
                     Txt.setText("Welcome To Java");
                  }
              });
         }
     }
/*<APPLET CODE=JavaExamleTooltipInJApplet.class WIDTH=300 HEIGHT=200 ></APPLET>*/