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 */
16package org.tp23.antinstaller.renderer.swing;
17
18import java.awt.Dimension;
19
20import javax.swing.JTextField;
21import 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
27 * @author Paul Hinds
28 * @version $Id: AITextfield.java,v 1.2 2006/12/09 15:26:09 teknopaul Exp $
29 */
30public class AITextfield extends JTextField {
31
32    public AITextfield() {
33        super();
34    }
35
36    public AITextfield(int columns) {
37        super(columns);
38    }
39
40    public AITextfield(String text) {
41        super(text);
42    }
43
44    public AITextfield(String text, int columns) {
45        super(text, columns);
46    }
47
48    public AITextfield(Document doc, String text, int columns) {
49        super(doc, text, columns);
50    }
51
52    private Dimension prefSize = new Dimension(SizeConstants.FIELD_WIDTH, SizeConstants.FIELD_HEIGHT);
53
54    public Dimension getMinimumSize() {
55        return prefSize;
56    }
57
58    public Dimension getPreferredSize() {
59        return prefSize;
60    }
61    public void setOverflow(Dimension prefSize) {
62        this.prefSize = prefSize;
63    }
64
65    public Dimension getMaximumSize() {
66        return prefSize;
67    }
68
69
70}