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.JTextField;
|
---|
21 | import javax.swing.text.Document;
|
---|
22 |
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * A JTextField with altered prefered size to facilitate fixing the width
|
---|
26 | * but still using a GridBagLayout. This text field is for use inconjunction
|
---|
27 | * with a button for example file chooser.
|
---|
28 | * @author Paul Hinds
|
---|
29 | * @version $Id: AIShortTextField.java,v 1.2 2006/12/09 15:26:10 teknopaul Exp $
|
---|
30 | */
|
---|
31 | public class AIShortTextField extends JTextField {
|
---|
32 |
|
---|
33 | public AIShortTextField() {
|
---|
34 | super();
|
---|
35 | }
|
---|
36 |
|
---|
37 | public AIShortTextField(int columns) {
|
---|
38 | super(columns);
|
---|
39 | }
|
---|
40 |
|
---|
41 | public AIShortTextField(String text) {
|
---|
42 | super(text);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public AIShortTextField(String text, int columns) {
|
---|
46 | super(text, columns);
|
---|
47 | }
|
---|
48 |
|
---|
49 | public AIShortTextField(Document doc, String text, int columns) {
|
---|
50 | super(doc, text, columns);
|
---|
51 | }
|
---|
52 |
|
---|
53 | private Dimension prefSize = new Dimension(SizeConstants.SHORT_FIELD_WIDTH, SizeConstants.FIELD_HEIGHT);
|
---|
54 |
|
---|
55 | public Dimension getMinimumSize() {
|
---|
56 | return prefSize;
|
---|
57 | }
|
---|
58 |
|
---|
59 | public Dimension getPreferredSize() {
|
---|
60 | return prefSize;
|
---|
61 | }
|
---|
62 | public void setOverflow(Dimension prefSize) {
|
---|
63 | this.prefSize = prefSize;
|
---|
64 | }
|
---|
65 |
|
---|
66 | public Dimension getMaximumSize() {
|
---|
67 | return prefSize;
|
---|
68 | }
|
---|
69 |
|
---|
70 |
|
---|
71 | }
|
---|