Java JLabel set tooltip text

Description

Java JLabel set tooltip text


import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main extends JFrame {

  public Main() {
    super("Link JLabel with JTextField");

    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JLabel nameLabel = new JLabel("Java demo from demo2s.com.");
    nameLabel.setToolTipText("Demo Tooltip for JLabel");

    add(nameLabel);//from  w  ww .ja v a 2s.c  o  m

  }

  public static void main(String[] args) {
    Main frame = new Main();
    frame.pack();
    frame.setVisible(true);
  }
}



PreviousNext

Related