List of usage examples for javax.swing ToolTipManager sharedInstance
public static ToolTipManager sharedInstance()
ToolTipManager
instance. From source file:Main.java
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;/*from www .ja va 2s. c o m*/ ToolTipManager.sharedInstance().setInitialDelay(initialDelay); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Tree Tips"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(new String[] { "a", "b", "c" }); ToolTipManager.sharedInstance().registerComponent(tree); TreeCellRenderer renderer = new ToolTipTreeCellRenderer(); tree.setCellRenderer(renderer);//from w w w .j a v a2 s. com JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JTextPane text = new JTextPane() { @Override/* w w w . j a v a2 s.co m*/ public String getToolTipText() { return ((JComponent) getParent()).getToolTipText(); } @Override public String getToolTipText(MouseEvent event) { return ((JComponent) getParent()).getToolTipText(event); } }; text.setText("Lorem ipsum dolor sit"); ToolTipManager.sharedInstance().registerComponent(text); JFrame frame = new JFrame("Testing"); JPanel panel = new JPanel(new BorderLayout()); panel.setToolTipText("tooltip from parent"); frame.setContentPane(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(text); frame.pack(); frame.setVisible(true); }
From source file:TreeTips.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Tips"); Properties props = System.getProperties(); JTree tree = new JTree(props); ToolTipManager.sharedInstance().registerComponent(tree); TreeCellRenderer renderer = new ToolTipTreeCellRenderer(props); tree.setCellRenderer(renderer);//w w w.j a v a2 s . c om JScrollPane scrollPane = new JScrollPane(tree); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Days"); for (DaysOfTheWeek dotw : DaysOfTheWeek.values()) { root.add(new DefaultMutableTreeNode(dotw)); }//w w w .j av a 2 s . com final DefaultTreeModel model = new DefaultTreeModel(root); JTree tree = new JTree(model); tree.setRootVisible(true); tree.setShowsRootHandles(true); ToolTipManager.sharedInstance().registerComponent(tree); tree.setCellRenderer(new MyTreeCellRenderer()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JScrollPane(tree)); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Node root = new Node("Root"); fillTree(root, 5, "tree label"); DefaultTreeModel model = new DefaultTreeModel(root); JTree tree = new JTree(model); ToolTipManager.sharedInstance().registerComponent(tree); tree.setCellRenderer(new MyTreeCellRenderer()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JScrollPane(tree)); f.pack();/*from w w w . j a v a 2s .c o m*/ f.setVisible(true); }
From source file:ToolTipTreeCellRenderer.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Tips"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Properties props = System.getProperties(); JTree tree = new JTree(props); ToolTipManager.sharedInstance().registerComponent(tree); TreeCellRenderer renderer = new ToolTipTreeCellRenderer(props); tree.setCellRenderer(renderer);//w w w .ja v a2 s. c om JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }
From source file:Main.java
public static final void emphasizeToolTip() { ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setDismissDelay(100000); toolTipManager.setInitialDelay(10);/*from www . j a va 2s . com*/ toolTipManager.setReshowDelay(10); }
From source file:Main.java
public Main() { super(new String[] { "A", "B", "C", "D", "E", "F", "G", "H" }); ToolTipManager.sharedInstance().registerComponent(this); }
From source file:Main.java
/** * make lightweight components visible over canvas *//*w w w . j a va 2 s . com*/ public static void makeLightWeightComponentsVisible() { JPopupMenu.setDefaultLightWeightPopupEnabled(false); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); }