setToolTipText

setToolTipText() :  SpecifIc text will be displayed when the mouse will pass over Swing Components.

Program

ytry

 

 

 

Program Source

import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.FlowLayout;

class Frame extends JFrame{
    
    Frame()
    {
        setTitle("setToolTipText");
        setLayout(new FlowLayout());
        setLabel();
        setSize(700, 200);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    
    private void setLabel()
    {
        JLabel jl = new JLabel("JLabel");
        jl.setToolTipText("This is JLabel");
        add(jl);
    }
}

public class Javaapp {
   
    public static void main(String[] args) {
        
        Frame frame = new Frame();
    }
}

Leave a Comment