Here you can find the source of addTooltipsToSplitter(final JSplitPane splitpane, final String hide, final String reveal)
Parameter | Description |
---|---|
splitpane | a parameter |
hide | a parameter |
reveal | a parameter |
public static void addTooltipsToSplitter(final JSplitPane splitpane, final String hide, final String reveal)
//package com.java2s; // it under the terms of the GNU General Public License as published by import javax.swing.*; import javax.swing.plaf.basic.BasicSplitPaneDivider; import java.awt.*; public class Main { /*********************************************************************************************** * Add Tooltips to the Splitter arrow icons. */* ww w. java 2 s . c om*/ * @param splitpane * @param hide * @param reveal */ public static void addTooltipsToSplitter(final JSplitPane splitpane, final String hide, final String reveal) { final int intComponentCount; // See: http://forums.sun.com/thread.jspa?threadID=714732&tstart=23790 // How to add the ToolTip to the little widgets in the JSplitpane intComponentCount = splitpane.getComponentCount(); for (int i = 0; i < intComponentCount; i++) { final Component component; component = splitpane.getComponent(i); if (component instanceof BasicSplitPaneDivider) { final BasicSplitPaneDivider divider; final int subComponentCount; divider = (BasicSplitPaneDivider) component; subComponentCount = divider.getComponentCount(); if (subComponentCount == 2) { if ((divider.getComponent(0) instanceof JButton) && (divider.getComponent(1) instanceof JButton)) { ((JButton) divider.getComponent(0)).setToolTipText(hide); ((JButton) divider.getComponent(1)).setToolTipText(reveal); } } } } } }