|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.text.JTextComponent | +--javax.swing.JTextField | +--NGP.Components.TextBox
A text box for single-line text entry. It is a subclass of the
Swing JTextField. You can change the text alignment easily and when
Return is pressed the returnPressed
method is
called.
Field Summary |
Fields inherited from class javax.swing.JTextField |
notifyAction |
Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
TextBox(Container container)
Construct a text box in container. |
|
TextBox(Container container,
int cols)
Construct the text box in container with specified width. |
|
TextBox(Container container,
String text)
Construct the text box in container with default text. |
|
TextBox(Container container,
String text,
int cols)
Construct the text box in container with default text and specified width. |
Method Summary | |
void |
alignCenter()
Align the text in the box to the center. |
void |
alignLeft()
Align the text in the box to the left. |
void |
alignRight()
Align the text in the box to the right. |
Dimension |
getDimension()
Get the preferred dimensions of this Component. |
void |
returnPressed()
This will be called when Return is pressed with focus in the text box. |
void |
setDimension(Dimension d)
Set the preferred dimensions of this Component. |
double |
textToDouble()
Convert the string value of the text box to a double. |
int |
textToInt()
Convert the string value of the text box to an int. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface NGP.Component |
setEnabled |
Methods inherited from interface NGP.Locatable |
getLocation, setLocation |
Constructor Detail |
public TextBox(Container container)
container
- the graphical container for the text boxpublic TextBox(Container container, String text)
container
- the graphical container for the text boxtext
- the default text for the text boxpublic TextBox(Container container, int cols)
container
- the graphical container for the text boxcols
- the number of columns (characters) a text box should takepublic TextBox(Container container, String text, int cols)
container
- the graphical container for the text boxtext
- the default text for the text boxcols
- the number of columns (characters) a text box should takeMethod Detail |
public void alignLeft()
public void alignRight()
public void alignCenter()
public void setDimension(Dimension d)
setDimension
in interface Sizeable
d
- the Dimension
for this Component
.getDimension
public Dimension getDimension()
getDimension
in interface Sizeable
Dimension
of this
Component
.setDimension
public void returnPressed()
public final int textToInt()
public final double textToDouble()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |