01: /*
02: * WbToolbarButton.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 java.awt.Insets;
15: import javax.swing.Action;
16: import javax.swing.Icon;
17: import javax.swing.UIManager;
18: import javax.swing.plaf.metal.MetalLookAndFeel;
19: import workbench.gui.WbSwingUtilities;
20:
21: /**
22: *
23: * @author support@sql-workbench.net
24: */
25: public class WbToolbarButton extends WbButton {
26: public static final Insets MARGIN = new Insets(1, 1, 1, 1);
27:
28: public WbToolbarButton() {
29: super ();
30: if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) {
31: enableToolbarRollover();
32: }
33: }
34:
35: public WbToolbarButton(String aText) {
36: super (aText);
37: initMargin();
38: }
39:
40: public WbToolbarButton(Action a) {
41: super (a);
42: this .setText(null);
43: iconButton = true;
44: initMargin();
45: }
46:
47: public WbToolbarButton(Icon icon) {
48: super (icon);
49: this .setText(null);
50: }
51:
52: public void setAction(Action a) {
53: super .setAction(a);
54: this .setText(null);
55: initMargin();
56: }
57:
58: private void initMargin() {
59: this .setMargin(MARGIN);
60: }
61:
62: public void setFlatLook() {
63: // if (WbManager.getInstance().isWindowsClassic())
64: // {
65: this .setBorder(WbSwingUtilities.FLAT_BUTTON_BORDER);
66: // }
67: }
68:
69: }
|