1 18 19 package org.objectweb.jac.aspects.gui.swing; 20 21 import java.awt.Dimension ; 22 23 26 public class JTextField extends javax.swing.JTextField 27 { 28 public JTextField() { 29 super(); 30 } 31 32 public JTextField(String text) { 33 super(text); 34 } 35 36 public JTextField(int columns) { 37 super(columns); 38 } 39 40 public JTextField(String text, int columns) { 41 super(text, columns); 42 } 43 44 public Dimension getPreferredSize() { 45 Dimension size = super.getPreferredSize(); 46 if (isMinimumSizeSet()) { 47 Dimension minSize = getMinimumSize(); 48 if (minSize.width>size.width) 49 size.width = minSize.width; 50 } 51 return size; 52 } 53 54 public Dimension getMaximumSize() { 55 Dimension maxSize = super.getMaximumSize(); 56 Dimension prefSize = getPreferredSize(); 57 maxSize.height = prefSize.height; 58 return maxSize; 59 } 60 } 61 | Popular Tags |