01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Sergey Burlak
20: * @version $Revision$
21: */package javax.swing.plaf.metal;
22:
23: import java.awt.Color;
24: import java.awt.Dimension;
25: import java.awt.Graphics;
26:
27: import javax.swing.UIManager;
28: import javax.swing.plaf.basic.BasicArrowButton;
29:
30: public class MetalScrollButton extends BasicArrowButton {
31: private int width;
32: private boolean freeStanding;
33: private static Color background = UIManager
34: .getColor("ScrollBar.background");
35: private static Color shadow = UIManager
36: .getColor("ScrollBar.shadow");
37: private static Color darkShadow = Color.black;
38: private static Color highlight = UIManager
39: .getColor("ScrollBar.highlight");;
40:
41: public MetalScrollButton(final int direction, final int width,
42: final boolean freeStanding) {
43: super (direction, background, shadow, darkShadow, highlight);
44:
45: this .width = width;
46: this .freeStanding = freeStanding;
47: }
48:
49: public void paint(final Graphics g) {
50: super .paint(g);
51: }
52:
53: public Dimension getPreferredSize() {
54: if (super .getPreferredSize() == null) {
55: return new Dimension(0, 0);
56: }
57: return new Dimension(width, super .getPreferredSize().height);
58: }
59:
60: public Dimension getMinimumSize() {
61: if (super .getMinimumSize() == null) {
62: return new Dimension(0, 0);
63: }
64: return super .getMinimumSize();
65: }
66:
67: public Dimension getMaximumSize() {
68: if (super .getMaximumSize() == null) {
69: return new Dimension(0, 0);
70: }
71: return super .getMaximumSize();
72: }
73:
74: public int getButtonWidth() {
75: return width;
76: }
77:
78: public void setFreeStanding(final boolean freeStanding) {
79: this.freeStanding = freeStanding;
80: }
81: }
|