//////////////////// Main.java ////////////////////
class Main
{
public static void main(String args[])
{
new MainWindow();
}
}
////////////////////////////////////////////////////////////
//////////////////// MainWindow.java ////////////////////
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.event.*;
public class MainWindow extends JFrame
{
JButton button1;
public MainWindow()
{
super("ToolTip Test");
setSize(255, 255);
WindowListener listener = new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
};
addWindowListener(listener);
button1 = new JButton("Over Me!");
button1.setToolTipText("ToolTipText!");
// JToolTipManagerの初期化
ToolTipManager manager = ToolTipManager.sharedInstance();
manager.setInitialDelay(0);
manager.registerComponent(button1);
getContentPane().add(BorderLayout.CENTER, button1);
show();
}
}
////////////////////////////////////////////////////////////
Source is here. (ZIP Format, 689Byte, Shift-JIS)