01: /*
02: * WbSplitPaneDivider.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.components;
13:
14: import javax.swing.JButton;
15: import javax.swing.plaf.basic.BasicSplitPaneDivider;
16: import javax.swing.plaf.basic.BasicSplitPaneUI;
17:
18: public class WbSplitPaneDivider extends BasicSplitPaneDivider {
19: private String oneTouchTooltip;
20:
21: public WbSplitPaneDivider(BasicSplitPaneUI ui) {
22: super (ui);
23: }
24:
25: public void setOneTouchTooltip(String tip) {
26: this .oneTouchTooltip = tip;
27: this .updateTooltip();
28: }
29:
30: protected JButton createLeftOneTouchButton() {
31: JButton b = super .createLeftOneTouchButton();
32: if (this .oneTouchTooltip != null) {
33: b.setToolTipText(this .oneTouchTooltip);
34: }
35: return b;
36: }
37:
38: protected JButton createRightOneTouchButton() {
39: JButton b = super .createRightOneTouchButton();
40: if (this .oneTouchTooltip != null) {
41: b.setToolTipText(this .oneTouchTooltip);
42: }
43: return b;
44: }
45:
46: private void updateTooltip() {
47: if (this.leftButton != null) {
48: this.leftButton.setToolTipText(this.oneTouchTooltip);
49: }
50: if (this.rightButton != null) {
51: this.rightButton.setToolTipText(this.oneTouchTooltip);
52: }
53: }
54: }
|