|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jmex.bui.BComponent
com.jmex.bui.BTextComponent
com.jmex.bui.BTextField
public class BTextField
Displays and allows for the editing of a single line of text.
| Field Summary | |
|---|---|
protected int |
_cursp
|
protected int |
_cursx
|
protected BText |
_glyphs
|
protected BKeyMap |
_keymap
|
protected int |
_prefWidth
|
protected boolean |
_showCursor
|
protected Rectangle |
_srect
|
protected Document |
_text
|
protected int |
_txoff
|
| Fields inherited from class com.jmex.bui.BTextComponent |
|---|
_effcols, _effsizes, _haligns, _lineSpacings, _teffects, _textfacts, _valigns |
| Fields inherited from class com.jmex.bui.BComponent |
|---|
_alpha, _backgrounds, _bbuf, _borders, _colors, _cursor, _enabled, _height, _hover, _insets, _listeners, _parent, _preferredSize, _properties, _styleClass, _tipmouse, _tipStyle, _tiptext, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES |
| Fields inherited from interface com.jmex.bui.text.EditCommands |
|---|
ACTION, BACKSPACE, CLEAR, CURSOR_LEFT, CURSOR_RIGHT, DELETE, END_OF_LINE, RELEASE_FOCUS, START_OF_LINE |
| Constructor Summary | |
|---|---|
BTextField()
Creates a blank text field. |
|
BTextField(int maxLength)
Creates a blank text field with maximum input length. |
|
BTextField(String text)
Creates a text field with the specified starting text. |
|
BTextField(String text,
int maxLength)
Creates a text field with the specified starting text and max length. |
|
| Method Summary | |
|---|---|
boolean |
acceptsFocus()
Returns whether or not this component accepts the keyboard focus. |
protected void |
clearGlyphs()
Clears out our text textures and other related bits. |
protected Dimension |
computePreferredSize(int whint,
int hhint)
Computes and returns a preferred size for this component. |
protected void |
configureStyle(BStyleSheet style)
Instructs this component to fetch its style configuration from the supplied style sheet. |
boolean |
dispatchEvent(BEvent event)
Instructs this component to process the supplied event. |
protected void |
gainedFocus()
Called when this text field has gained the focus. |
protected String |
getDefaultStyleClass()
Returns the default stylesheet class to be used for all instances of this component. |
protected String |
getDisplayText()
This method allows a derived class (specifically BPasswordField) to display something other than the actual
contents of the text field. |
Document |
getDocument()
Returns the underlying document used by this text field to maintain its state. |
String |
getText()
Returns the text currently being displayed by this component. |
protected void |
layout()
Instructs this component to lay itself out. |
protected void |
lostFocus()
Called when this text field has lost the focus. |
protected void |
recreateGlyphs()
Recreates the entity that we use to render our text. |
protected void |
renderComponent(Renderer renderer)
Renders any custom bits for this component. |
protected void |
setCursorPos(int cursorPos)
Updates the cursor position, moving the visible representation as well as the insertion and deletion point. |
void |
setDocument(Document document)
Configures this text field with a custom document. |
void |
setMaxLength(int maxLength)
Configures the maximum length of this text field. |
void |
setPreferredWidth(int width)
Configures the preferred width of this text field (the preferred height will be calculated from the font). |
void |
setText(String text)
Configures this text field with the specified text for display and editing. |
protected void |
stateDidChange()
Called when the component's state has changed. |
void |
textInserted(Document document,
int offset,
int length)
Called when text is inserted into a document. |
void |
textRemoved(Document document,
int offset,
int length)
Called when text is removed from a document. |
protected void |
wasAdded()
This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up). |
protected void |
wasRemoved()
This method is called when we are removed from a hierarchy that is connected to a top-level window. |
| Methods inherited from class com.jmex.bui.BTextComponent |
|---|
checkNonDefault, checkNonDefaultInt, checkNonDefaultVal, getEffectColor, getEffectSize, getHorizontalAlignment, getLabelConfig, getLineSpacing, getTextEffect, getTextFactory, getTextFactory, getVerticalAlignment |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Document _text
protected BText _glyphs
protected BKeyMap _keymap
protected int _prefWidth
protected boolean _showCursor
protected int _cursp
protected int _cursx
protected int _txoff
protected Rectangle _srect
| Constructor Detail |
|---|
public BTextField()
public BTextField(int maxLength)
LengthLimitedDocument, changing the
document will remove the length control.
public BTextField(String text)
public BTextField(String text,
int maxLength)
LengthLimitedDocument, changing the document will remove the length
control.
| Method Detail |
|---|
public void setText(String text)
setText in class BTextComponentpublic String getText()
BTextComponent
getText in class BTextComponentpublic void setMaxLength(int maxLength)
public void setDocument(Document document)
public Document getDocument()
public void setPreferredWidth(int width)
public void textInserted(Document document,
int offset,
int length)
Document.Listener
textInserted in interface Document.Listenerdocument - the document into which text was inserted.offset - the offset into the document of the inserted text.length - the length of the inserted text.
public void textRemoved(Document document,
int offset,
int length)
Document.Listener
textRemoved in interface Document.Listenerdocument - the document from which text was removed.offset - the offset into the document of the removed text.length - the length of the removed text.public boolean acceptsFocus()
BComponent
acceptsFocus in class BComponentpublic boolean dispatchEvent(BEvent event)
BComponentsuper.dispatchEvent for events that they did not "consume".
dispatchEvent in class BComponentprotected String getDefaultStyleClass()
BComponent
getDefaultStyleClass in class BComponentprotected void configureStyle(BStyleSheet style)
BComponent
configureStyle in class BTextComponentprotected void wasAdded()
BComponent
wasAdded in class BComponentprotected void wasRemoved()
BComponentBComponent.wasAdded(), this is a fine place
to do so.
wasRemoved in class BComponentprotected void layout()
BComponent
layout in class BComponentprotected void stateDidChange()
BComponent
stateDidChange in class BComponentprotected void renderComponent(Renderer renderer)
BComponent
renderComponent in class BComponent
protected Dimension computePreferredSize(int whint,
int hhint)
BComponent
computePreferredSize in class BComponentprotected void gainedFocus()
protected void lostFocus()
protected void recreateGlyphs()
protected void clearGlyphs()
protected String getDisplayText()
BPasswordField) to display something other than the actual
contents of the text field.
protected void setCursorPos(int cursorPos)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||