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: * @author Alexander T. Simbirtsev
19: * @version $Revision$
20: */package javax.swing.border;
21:
22: import java.awt.Component;
23: import java.awt.Graphics;
24: import java.awt.Insets;
25: import java.io.Serializable;
26:
27: public class EmptyBorder extends AbstractBorder implements Serializable {
28:
29: protected int left;
30: protected int right;
31: protected int top;
32: protected int bottom;
33:
34: public EmptyBorder(final Insets insets) {
35: top = insets.top;
36: left = insets.left;
37: right = insets.right;
38: bottom = insets.bottom;
39: }
40:
41: public EmptyBorder(final int top, final int left, final int bottom,
42: final int right) {
43: this .top = top;
44: this .left = left;
45: this .right = right;
46: this .bottom = bottom;
47: }
48:
49: /**
50: * This constructor initialize vertical and horizontal insets
51: * with the same value
52: *
53: * @param topBottom - specifies vertical (top and bottom) insets
54: * @param leftRight - specifies horizontal (left and right) insets
55: *
56: */
57: EmptyBorder(final int topBottom, final int leftRight) {
58: top = topBottom;
59: bottom = topBottom;
60:
61: left = leftRight;
62: right = leftRight;
63: }
64:
65: public Insets getBorderInsets(final Component component,
66: final Insets insets) {
67: if (insets != null) {
68: insets.top = top;
69: insets.left = left;
70: insets.right = right;
71: insets.bottom = bottom;
72:
73: return insets;
74: }
75:
76: return getBorderInsets(component);
77: }
78:
79: public Insets getBorderInsets(final Component component) {
80: return new Insets(top, left, bottom, right);
81: }
82:
83: public void paintBorder(final Component c, final Graphics g,
84: final int x, final int y, final int width, final int height) {
85: }
86:
87: public Insets getBorderInsets() {
88: return getBorderInsets(null);
89: }
90:
91: public boolean isBorderOpaque() {
92: return false;
93: }
94:
95: }
|