import java.awt.FlowLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.ToolTipManager;
public class Main extends JFrame {
public Main() throws HeadlessException {
setSize(300, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));
JButton disable = new JButton("DISABLE");
disable.setToolTipText("disabled.");
disable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ToolTipManager.sharedInstance().setEnabled(false);
}
});
JButton enable = new JButton("ENABLE");
enable.setToolTipText("enabled.");
enable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ToolTipManager.sharedInstance().setEnabled(true);
}
});
getContentPane().add(enable);
getContentPane().add(disable);
}
public static void main(String[] args) {
new Main().setVisible(true);
}
}
|