01: /*
02: * Copyright 2005 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.tp23.antinstaller.renderer.swing;
17:
18: import java.awt.Dimension;
19:
20: import javax.swing.Icon;
21: import javax.swing.JLabel;
22:
23: /**
24: * A JLabel with altered prefered size to facilitate fixing the width
25: * but still using a GridBagLayout
26: * @author Paul Hinds
27: * @version $Id: AILabel.java,v 1.2 2006/12/09 15:26:09 teknopaul Exp $
28: */
29: public class AILabel extends JLabel {
30:
31: public AILabel() {
32: super ();
33: }
34:
35: public AILabel(String text) {
36: super (text);
37: }
38:
39: public AILabel(String text, int horizontalAlignment) {
40: super (text, horizontalAlignment);
41: }
42:
43: public AILabel(Icon image) {
44: super (image);
45: }
46:
47: public AILabel(Icon image, int horizontalAlignment) {
48: super (image, horizontalAlignment);
49: }
50:
51: public AILabel(String text, Icon icon, int horizontalAlignment) {
52: super (text, icon, horizontalAlignment);
53: }
54:
55: private Dimension prefSize = new Dimension(
56: SizeConstants.LABEL_WIDTH, SizeConstants.FIELD_HEIGHT);
57:
58: public Dimension getMinimumSize() {
59: return prefSize;
60: }
61:
62: public Dimension getPreferredSize() {
63: return prefSize;
64: }
65:
66: public void setOverflow(Dimension prefSize) {
67: this .prefSize = prefSize;
68: }
69:
70: public Dimension getMaximumSize() {
71: return prefSize;
72: }
73:
74: public boolean isOpaque() {
75: return false;
76: }
77: }
|