001: /*
002: * Copyright Javelin Software, All rights reserved.
003: */
004:
005: package com.javelin.swinglets;
006:
007: import java.awt.*;
008: import java.util.*;
009: import java.io.*;
010:
011: /**
012: * STextField defines an text field. Max length defaults to 255.
013: *
014: * @author Robin Sharp
015: */
016:
017: public class STextField extends STextComponent {
018:
019: /**
020: * Creates a STextField with the following text and columns, and max length.
021: */
022: public STextField(String text, int columns, int maxLength) {
023: super (text);
024: this .columns = columns;
025: this .maxLength = maxLength;
026: }
027:
028: /**
029: * Creates a STextField with the following text and columns.
030: */
031: public STextField(String text, int columns) {
032: super (text);
033: this .columns = columns;
034: }
035:
036: /**
037: * Creates a STextField with the following text.
038: */
039: public STextField(String text) {
040: this (text, 30);
041: }
042:
043: /**
044: * Creates a STextField with the following columns.
045: */
046: public STextField(int columns) {
047: this (null, columns);
048: }
049:
050: /**
051: * Creates a STextField.
052: */
053: public STextField() {
054: this (null, 30);
055: }
056:
057: /**
058: * Returns the name of the L&F class that renders this component.
059: */
060: public Class getUIClass() {
061: return STextField.class;
062: }
063:
064: /**
065: * Get the number of columns.
066: */
067: public int getColumns() {
068: return columns;
069: }
070:
071: /**
072: * Set the number of columns.
073: */
074: public STextField setColumns(int columns) {
075: firePropertyChange("columns", this .columns,
076: this .columns = columns);
077: return this ;
078: }
079:
080: /**
081: * Get the maximum length of the text.
082: */
083: public int getMaxLength() {
084: return maxLength;
085: }
086:
087: /**
088: * Set the maximum length of the text.
089: */
090: public STextField setMaxLength(int maxLength) {
091: firePropertyChange("maxLength", this .maxLength,
092: this .maxLength = maxLength);
093: return this ;
094: }
095:
096: // PRIVATE /////////////////////////////////////////////////
097:
098: protected int columns = 30;
099: protected int maxLength = 255;
100:
101: }
|