1 | /*
|
---|
2 | * Copyright 2005 Paul Hinds
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
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 | /**
|
---|
25 | * A JLabel with altered prefered size to facilitate fixing the width
|
---|
26 | * but still using a GridBagLayout
|
---|
27 | * @author Paul Hinds
|
---|
28 | * @version $Id: AILabel.java,v 1.2 2006/12/09 15:26:09 teknopaul Exp $
|
---|
29 | */
|
---|
30 | public class AILabel extends JLabel {
|
---|
31 |
|
---|
32 | public AILabel() {
|
---|
33 | super();
|
---|
34 | }
|
---|
35 | public AILabel(String text) {
|
---|
36 | super(text);
|
---|
37 | }
|
---|
38 | public AILabel(String text, int horizontalAlignment) {
|
---|
39 | super(text, horizontalAlignment);
|
---|
40 | }
|
---|
41 | public AILabel(Icon image) {
|
---|
42 | super(image);
|
---|
43 | }
|
---|
44 | public AILabel(Icon image, int horizontalAlignment) {
|
---|
45 | super(image, horizontalAlignment);
|
---|
46 | }
|
---|
47 | public AILabel(String text, Icon icon, int horizontalAlignment) {
|
---|
48 | super(text, icon, horizontalAlignment);
|
---|
49 | }
|
---|
50 | private Dimension prefSize= new Dimension(SizeConstants.LABEL_WIDTH,
|
---|
51 | SizeConstants.FIELD_HEIGHT);
|
---|
52 | public Dimension getMinimumSize() {
|
---|
53 | return prefSize;
|
---|
54 | }
|
---|
55 | public Dimension getPreferredSize() {
|
---|
56 | return prefSize;
|
---|
57 | }
|
---|
58 | public void setOverflow(Dimension prefSize) {
|
---|
59 | this.prefSize = prefSize;
|
---|
60 | }
|
---|
61 | public Dimension getMaximumSize() {
|
---|
62 | return prefSize;
|
---|
63 | }
|
---|
64 |
|
---|
65 | }
|
---|