Class marimba.gui.TextBoxWidget
All Packages Class Hierarchy This Package Previous Next Index
Class marimba.gui.TextBoxWidget
java.lang.Object
|
+----marimba.gui.Widget
|
+----marimba.gui.TextWidget
|
+----marimba.gui.TextBoxWidget
- public class TextBoxWidget
- extends TextWidget
- implements TimerClient
A single line text widget.
- Version:
- 1.96, 01/18/97
- Author:
- Arthur van Hoff, Klaas Waslander
-
align
- Text can be aligned to the left, right or can be centered.
-
alignOptions
- The possible options for the align.
-
caretPos
- The current position of the caret.
-
caretVisible
- Used to let the caret blink: when caretVisible is true
paint() paints the caret, otherwise it doesn't.
-
echoCharacter
- The echo character for this TextBox, which is useful when the
user input shouldn't be echoed to the screen, as in the case
of a TextBox that represents a password.
-
len
- The length of the text.
-
savetext
- The textboxwidget can retrieve its content in a future
session or start blank again.
-
selEnd
- The ending position of the selection.
-
selStart
- The starting position of the selection.
-
shadowColor
- The color for the shadow of the characters.
-
style
- A textbox can be plain, boxed, filled and underlined.
-
styleOptions
- The possible options for the style.
-
text
- The content of the textbox.
-
textColor
- The color in which the text is painted,
by default always the foreground color;
but in subclasses one can set this color
to something else and draw just the text
in a different color.
-
TextBoxWidget()
- Default constructor.
-
TextBoxWidget(String)
- Constructor with value.
-
TextBoxWidget(String, boolean, int)
- Constructor with value for editing.
-
action()
- Perform the default action.
-
applyProperties(PropertyList)
- When applying new properties to the textbox also
set the text color.
-
delete()
- Clear the current selection.
-
focus(int)
- Focus on a given position.
-
getAlign()
- Get the alignment of this widget.
-
getAlignOptions()
- Get the possible options for align.
-
getEchoCharacter()
- Get the character that is echoed to the screen
for every character in the user input.
-
getEditor()
- Get the editor for this widget.
-
getLength()
- Get the length of the text.
-
getProperties(PropertyList)
- Get the properties of this widget.
-
getSavetext()
- Check whether the text is being saved.
-
getSelected()
- Get the selected part of the text.
-
getSelEnd()
- Return the end of the selection.
-
getSelStart()
- Return the start of the selection.
-
getShadowColor()
- Check the shadowColor of this textBox.
-
getStyle()
- Get the style of this widget.
-
getStyleOptions()
- Get the possible options for the style.
-
getText()
- Get the value of the text.
-
getTextChars()
- Return text characters that are being displayed,
overriding this method changes the characters
that are being displayed.
-
handleEvent(Event)
- Handle mouse and character events.
-
insert(char)
- Insert a character.
-
insert(String)
- Insert a string at the current caret position.
-
leftMargin()
- Left margin.
-
nextWordPos(int)
- The starting position of the next word.
-
paint(Graphics)
- Paint the text widget.
-
paintBackground(Graphics)
- Paint the text widget.
-
previousWordPos(int)
- The starting, position of the previous word.
-
rightMargin()
- Right margin.
-
select(int, int, int)
- Select a portion of the text.
-
setAlign(int)
- Set the style of this widget.
-
setEchoCharacter(Character)
- Set the character that is echoed to the screen
for every character in the user input.
-
setForeground(Color)
- When setting the foreground color also
update the color of the text.
-
setProperties(PropertyList)
- Set the properties of this widget.
-
setSavetext(boolean)
- Let the text be saved or not.
-
setShadowColor(Color)
- Set the shadowColor of this textBox.
-
setStyle(int)
- Set the style of this widget.
-
setText(String)
- Set the value of the text.
-
tick(long, Object)
- Blink the caret.
-
x2pos(int)
- Convert an x coordinate into a text position.
align
public int align
- Text can be aligned to the left, right or can be centered.
- See Also:
- getAlign, setAlign, alignOptions
alignOptions
public static Options alignOptions
- The possible options for the align.
- See Also:
- getAlignOptions, align
style
public int style
- A textbox can be plain, boxed, filled and underlined.
- See Also:
- getStyle, setStyle, styleOptions
styleOptions
public static Options styleOptions
- The possible options for the style.
- See Also:
- getStyleOptions, style
caretVisible
public boolean caretVisible
- Used to let the caret blink: when caretVisible is true
paint() paints the caret, otherwise it doesn't.
savetext
public boolean savetext
- The textboxwidget can retrieve its content in a future
session or start blank again.
- See Also:
- getSavetext, setSavetext
shadowColor
public Color shadowColor
- The color for the shadow of the characters.
- See Also:
- getShadowColor, setShadowColor
len
public int len
- The length of the text.
- See Also:
- text, getLength
text
public char text[]
- The content of the textbox. The size of this array is increased
by four in setText whenever necessary.
- See Also:
- len, getText, getTextChars, setText
selStart
public int selStart
- The starting position of the selection.
- See Also:
- getSelStart
selEnd
public int selEnd
- The ending position of the selection.
- See Also:
- getSelEnd
caretPos
public int caretPos
- The current position of the caret.
echoCharacter
public Character echoCharacter
- The echo character for this TextBox, which is useful when the
user input shouldn't be echoed to the screen, as in the case
of a TextBox that represents a password. For every character
in the input this character is being echoed.
- See Also:
- getEchoCharacter, setEchoCharacter
textColor
protected Color textColor
- The color in which the text is painted,
by default always the foreground color;
but in subclasses one can set this color
to something else and draw just the text
in a different color.
TextBoxWidget
public TextBoxWidget()
- Default constructor.
TextBoxWidget
public TextBoxWidget(String text)
- Constructor with value.
TextBoxWidget
public TextBoxWidget(String text,
boolean editable,
int style)
- Constructor with value for editing.
getProperties
public void getProperties(PropertyList list)
- Get the properties of this widget.
- Overrides:
- getProperties in class TextWidget
setProperties
public void setProperties(PropertyList list)
- Set the properties of this widget.
- Overrides:
- setProperties in class TextWidget
applyProperties
public void applyProperties(PropertyList list)
- When applying new properties to the textbox also
set the text color.
- Overrides:
- applyProperties in class Widget
- See Also:
- textColor
setForeground
public void setForeground(Color c)
- When setting the foreground color also
update the color of the text.
- Overrides:
- setForeground in class Widget
- See Also:
- textColor
getAlignOptions
public Options getAlignOptions()
- Get the possible options for align.
- See Also:
- alignOptions
getStyleOptions
public Options getStyleOptions()
- Get the possible options for the style.
getEditor
public String getEditor()
- Get the editor for this widget.
- Overrides:
- getEditor in class Widget
getLength
public int getLength()
- Get the length of the text.
- Overrides:
- getLength in class TextWidget
- See Also:
- len
getSelStart
public int getSelStart()
- Return the start of the selection.
- Overrides:
- getSelStart in class TextWidget
- See Also:
- selStart
getSelEnd
public int getSelEnd()
- Return the end of the selection.
- Overrides:
- getSelEnd in class TextWidget
- See Also:
- selEnd
getEchoCharacter
public Character getEchoCharacter()
- Get the character that is echoed to the screen
for every character in the user input.
Returns null if it is not set.
- See Also:
- echoCharacter
setEchoCharacter
public void setEchoCharacter(Character echoCharacter)
- Set the character that is echoed to the screen
for every character in the user input.
Specify null if you want to disable this.
- See Also:
- echoCharacter
getText
public String getText()
- Get the value of the text.
- Overrides:
- getText in class Widget
- See Also:
- text
getTextChars
public char[] getTextChars()
- Return text characters that are being displayed,
overriding this method changes the characters
that are being displayed.
- See Also:
- text
setText
public void setText(String text)
- Set the value of the text.
- Overrides:
- setText in class Widget
- See Also:
- text
getStyle
public int getStyle()
- Get the style of this widget.
- See Also:
- style
setStyle
public void setStyle(int style)
- Set the style of this widget.
- See Also:
- style
getAlign
public int getAlign()
- Get the alignment of this widget.
- See Also:
- align
setAlign
public void setAlign(int align)
- Set the style of this widget.
- See Also:
- align
getSavetext
public boolean getSavetext()
- Check whether the text is being saved.
- See Also:
- savetext
setSavetext
public void setSavetext(boolean savetext)
- Let the text be saved or not.
- See Also:
- savetext
getShadowColor
public Color getShadowColor()
- Check the shadowColor of this textBox.
- See Also:
- shadowColor
setShadowColor
public void setShadowColor(Color shadowColor)
- Set the shadowColor of this textBox.
- See Also:
- shadowColor
delete
public void delete()
- Clear the current selection.
- Overrides:
- delete in class TextWidget
insert
public void insert(char ch)
- Insert a character. This will first clear the selecton,
before inserting the character.
- Overrides:
- insert in class TextWidget
insert
public void insert(String str)
- Insert a string at the current caret position.
- Overrides:
- insert in class TextWidget
getSelected
public String getSelected()
- Get the selected part of the text.
- Overrides:
- getSelected in class TextWidget
- See Also:
- select
select
public void select(int selStart,
int selEnd,
int depth)
- Select a portion of the text. Depth controls character (1),
word (2), and line selection (3).
- Overrides:
- select in class TextWidget
- See Also:
- getSelected
tick
public long tick(long tm,
Object arg)
- Blink the caret.
- Overrides:
- tick in class Widget
leftMargin
public int leftMargin()
- Left margin.
- See Also:
- rightMargin
rightMargin
public int rightMargin()
- Right margin.
- See Also:
- leftMargin
focus
public void focus(int pos)
- Focus on a given position. This will scroll the position into view.
It will also change the caretPosition to the focused position.
- Overrides:
- focus in class TextWidget
previousWordPos
public int previousWordPos(int pos)
- The starting, position of the previous word.
- See Also:
- nextWordPos
nextWordPos
public int nextWordPos(int pos)
- The starting position of the next word.
- See Also:
- previousWordPos
paintBackground
public void paintBackground(Graphics g)
- Paint the text widget.
paint
public void paint(Graphics g)
- Paint the text widget.
- Overrides:
- paint in class Widget
x2pos
public int x2pos(int x)
- Convert an x coordinate into a text position.
handleEvent
public boolean handleEvent(Event evt)
- Handle mouse and character events.
- Overrides:
- handleEvent in class TextWidget
action
public void action()
- Perform the default action.
- Overrides:
- action in class Widget
All Packages Class Hierarchy This Package Previous Next Index