package org.nhooo.example.swing;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
import java.awt.FlowLayout;
public class ToolTipExample {
public static void main(String[] args) {
JFrame frame = new JFrame("Tool Tip Demo");
frame.setSize(200, 200);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hover on me!");
// Swing JLabel组件的设置工具提示
label.setToolTipText("My JLabel Tool Tip");
frame.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));
frame.getContentPane().add(label);
frame.setVisible(true);
}
}