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>*/




About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles