Make a tool tips appear immediately in Java

Description

The following code shows how to make a tool tips appear immediately.

Example


  //w  w w.ja  v a 2s.c  o m


import javax.swing.ToolTipManager;

public class Main {
  public static void main(String[] argv) throws Exception {
    // Get current delay
    int initialDelay = ToolTipManager.sharedInstance().getInitialDelay();

    // Show tool tips immediately
    ToolTipManager.sharedInstance().setInitialDelay(0);

    // Show tool tips after a second
    initialDelay = 1000;
    ToolTipManager.sharedInstance().setInitialDelay(initialDelay);
  }
}




















Home »
  Java Tutorial »
    Swing »




Action
Border
Color Chooser
Drag and Drop
Event
Font Chooser
JButton
JCheckBox
JComboBox
JDialog
JEditorPane
JFileChooser
JFormattedText
JFrame
JLabel
JList
JOptionPane
JPasswordField
JProgressBar
JRadioButton
JScrollBar
JScrollPane
JSeparator
JSlider
JSpinner
JSplitPane
JTabbedPane
JTable
JTextArea
JTextField
JTextPane
JToggleButton
JToolTip
JTree
Layout
Menu
Timer