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