001 /*
002 * Copyright (c) Holger Pfaff - http://pfaff.ws
003 *
004 * This software maybe used for any purpose provided the
005 * above copyright notice is retained. It is supplied as is.
006 * No warranty expressed or implied - Use at your own risk.
007 */
008
009 import java.awt.TextField;
010
011 /**
012 * (#)EditField.java
013 * @author Holger Pfaff
014 * @version 3.2 19-Mar-2004<br><br>
015 *
016 * A wrapper around (AWT) TextField to overcome some shortcomings
017 *
018 */
019
020 public class EditField extends AwtText {
021
022 /**
023 * Constructor with string init
024 */
025 public EditField(String text) {
026 this(text, 20);
027 }
028
029 /**
030 * Constructor with length spec
031 */
032 public EditField(int len) {
033 this("", len);
034 }
035
036 /**
037 * Constructor with length spec & string init
038 */
039 public EditField(String text, int len) {
040 textcomp = new TextField(text, len);
041 add(textcomp);
042 }
043
044 /**
045 * Return the wrapped comp
046 *
047 * @return warpped TextField
048 */
049 public TextField getTextField() {
050 return (TextField) textcomp;
051 }
052
053 /**
054 * implement TextField.getEchoChar()
055 */
056 public char getEchoChar() {
057 return getTextField().getEchoChar();
058 }
059
060 /**
061 * implement TextField.setEchoChar()
062 */
063 public void setEchoChar(char c) {
064 getTextField().setEchoChar(c);
065 }
066
067 /**
068 * implement TextField.echoCharIsSet()
069 */
070 public boolean echoCharIsSet() {
071 return getTextField().echoCharIsSet();
072 }
073
074 /**
075 * implement TextField.getColumns()
076 */
077 public int getColumns() {
078 return getTextField().getColumns();
079 }
080
081 /**
082 * implement TextField.setColumns()
083 */
084 public void setColumns(int columns) {
085 getTextField().setColumns(columns);
086 }
087 }