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
26: * @author Paul Hinds
27: * @version $Id: AITextfield.java,v 1.2 2006/12/09 15:26:09 teknopaul Exp $
28: */
29: public class AITextfield extends JTextField {
30:
31: public AITextfield() {
32: super ();
33: }
34:
35: public AITextfield(int columns) {
36: super (columns);
37: }
38:
39: public AITextfield(String text) {
40: super (text);
41: }
42:
43: public AITextfield(String text, int columns) {
44: super (text, columns);
45: }
46:
47: public AITextfield(Document doc, String text, int columns) {
48: super (doc, text, columns);
49: }
50:
51: private Dimension prefSize = new Dimension(
52: 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:
62: public void setOverflow(Dimension prefSize) {
63: this .prefSize = prefSize;
64: }
65:
66: public Dimension getMaximumSize() {
67: return prefSize;
68: }
69:
70: }
|