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

Variable Index

 o align
Text can be aligned to the left, right or can be centered.
 o alignOptions
The possible options for the align.
 o caretPos
The current position of the caret.
 o caretVisible
Used to let the caret blink: when caretVisible is true paint() paints the caret, otherwise it doesn't.
 o 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.
 o len
The length of the text.
 o savetext
The textboxwidget can retrieve its content in a future session or start blank again.
 o selEnd
The ending position of the selection.
 o selStart
The starting position of the selection.
 o shadowColor
The color for the shadow of the characters.
 o style
A textbox can be plain, boxed, filled and underlined.
 o styleOptions
The possible options for the style.
 o text
The content of the textbox.
 o 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.

Constructor Index

 o TextBoxWidget()
Default constructor.
 o TextBoxWidget(String)
Constructor with value.
 o TextBoxWidget(String, boolean, int)
Constructor with value for editing.

Method Index

 o action()
Perform the default action.
 o applyProperties(PropertyList)
When applying new properties to the textbox also set the text color.
 o delete()
Clear the current selection.
 o focus(int)
Focus on a given position.
 o getAlign()
Get the alignment of this widget.
 o getAlignOptions()
Get the possible options for align.
 o getEchoCharacter()
Get the character that is echoed to the screen for every character in the user input.
 o getEditor()
Get the editor for this widget.
 o getLength()
Get the length of the text.
 o getProperties(PropertyList)
Get the properties of this widget.
 o getSavetext()
Check whether the text is being saved.
 o getSelected()
Get the selected part of the text.
 o getSelEnd()
Return the end of the selection.
 o getSelStart()
Return the start of the selection.
 o getShadowColor()
Check the shadowColor of this textBox.
 o getStyle()
Get the style of this widget.
 o getStyleOptions()
Get the possible options for the style.
 o getText()
Get the value of the text.
 o getTextChars()
Return text characters that are being displayed, overriding this method changes the characters that are being displayed.
 o handleEvent(Event)
Handle mouse and character events.
 o insert(char)
Insert a character.
 o insert(String)
Insert a string at the current caret position.
 o leftMargin()
Left margin.
 o nextWordPos(int)
The starting position of the next word.
 o paint(Graphics)
Paint the text widget.
 o paintBackground(Graphics)
Paint the text widget.
 o previousWordPos(int)
The starting, position of the previous word.
 o rightMargin()
Right margin.
 o select(int, int, int)
Select a portion of the text.
 o setAlign(int)
Set the style of this widget.
 o setEchoCharacter(Character)
Set the character that is echoed to the screen for every character in the user input.
 o setForeground(Color)
When setting the foreground color also update the color of the text.
 o setProperties(PropertyList)
Set the properties of this widget.
 o setSavetext(boolean)
Let the text be saved or not.
 o setShadowColor(Color)
Set the shadowColor of this textBox.
 o setStyle(int)
Set the style of this widget.
 o setText(String)
Set the value of the text.
 o tick(long, Object)
Blink the caret.
 o x2pos(int)
Convert an x coordinate into a text position.

Variables

 o align
  public int align
Text can be aligned to the left, right or can be centered.
See Also:
getAlign, setAlign, alignOptions
 o alignOptions
  public static Options alignOptions
The possible options for the align.
See Also:
getAlignOptions, align
 o style
  public int style
A textbox can be plain, boxed, filled and underlined.
See Also:
getStyle, setStyle, styleOptions
 o styleOptions
  public static Options styleOptions
The possible options for the style.
See Also:
getStyleOptions, style
 o caretVisible
  public boolean caretVisible
Used to let the caret blink: when caretVisible is true paint() paints the caret, otherwise it doesn't.
 o savetext
  public boolean savetext
The textboxwidget can retrieve its content in a future session or start blank again.
See Also:
getSavetext, setSavetext
 o shadowColor
  public Color shadowColor
The color for the shadow of the characters.
See Also:
getShadowColor, setShadowColor
 o len
  public int len
The length of the text.
See Also:
text, getLength
 o 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
 o selStart
  public int selStart
The starting position of the selection.
See Also:
getSelStart
 o selEnd
  public int selEnd
The ending position of the selection.
See Also:
getSelEnd
 o caretPos
  public int caretPos
The current position of the caret.
 o 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
 o 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.

Constructors

 o TextBoxWidget
  public TextBoxWidget()
Default constructor.
 o TextBoxWidget
  public TextBoxWidget(String text)
Constructor with value.
 o TextBoxWidget
  public TextBoxWidget(String text,
                       boolean editable,
                       int style)
Constructor with value for editing.

Methods

 o getProperties
  public void getProperties(PropertyList list)
Get the properties of this widget.
Overrides:
getProperties in class TextWidget
 o setProperties
  public void setProperties(PropertyList list)
Set the properties of this widget.
Overrides:
setProperties in class TextWidget
 o 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
 o 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
 o getAlignOptions
  public Options getAlignOptions()
Get the possible options for align.
See Also:
alignOptions
 o getStyleOptions
  public Options getStyleOptions()
Get the possible options for the style.
 o getEditor
  public String getEditor()
Get the editor for this widget.
Overrides:
getEditor in class Widget
 o getLength
  public int getLength()
Get the length of the text.
Overrides:
getLength in class TextWidget
See Also:
len
 o getSelStart
  public int getSelStart()
Return the start of the selection.
Overrides:
getSelStart in class TextWidget
See Also:
selStart
 o getSelEnd
  public int getSelEnd()
Return the end of the selection.
Overrides:
getSelEnd in class TextWidget
See Also:
selEnd
 o 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
 o 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
 o getText
  public String getText()
Get the value of the text.
Overrides:
getText in class Widget
See Also:
text
 o getTextChars
  public char[] getTextChars()
Return text characters that are being displayed, overriding this method changes the characters that are being displayed.
See Also:
text
 o setText
  public void setText(String text)
Set the value of the text.
Overrides:
setText in class Widget
See Also:
text
 o getStyle
  public int getStyle()
Get the style of this widget.
See Also:
style
 o setStyle
  public void setStyle(int style)
Set the style of this widget.
See Also:
style
 o getAlign
  public int getAlign()
Get the alignment of this widget.
See Also:
align
 o setAlign
  public void setAlign(int align)
Set the style of this widget.
See Also:
align
 o getSavetext
  public boolean getSavetext()
Check whether the text is being saved.
See Also:
savetext
 o setSavetext
  public void setSavetext(boolean savetext)
Let the text be saved or not.
See Also:
savetext
 o getShadowColor
  public Color getShadowColor()
Check the shadowColor of this textBox.
See Also:
shadowColor
 o setShadowColor
  public void setShadowColor(Color shadowColor)
Set the shadowColor of this textBox.
See Also:
shadowColor
 o delete
  public void delete()
Clear the current selection.
Overrides:
delete in class TextWidget
 o insert
  public void insert(char ch)
Insert a character. This will first clear the selecton, before inserting the character.
Overrides:
insert in class TextWidget
 o insert
  public void insert(String str)
Insert a string at the current caret position.
Overrides:
insert in class TextWidget
 o getSelected
  public String getSelected()
Get the selected part of the text.
Overrides:
getSelected in class TextWidget
See Also:
select
 o 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
 o tick
  public long tick(long tm,
                   Object arg)
Blink the caret.
Overrides:
tick in class Widget
 o leftMargin
  public int leftMargin()
Left margin.
See Also:
rightMargin
 o rightMargin
  public int rightMargin()
Right margin.
See Also:
leftMargin
 o 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
 o previousWordPos
  public int previousWordPos(int pos)
The starting, position of the previous word.
See Also:
nextWordPos
 o nextWordPos
  public int nextWordPos(int pos)
The starting position of the next word.
See Also:
previousWordPos
 o paintBackground
  public void paintBackground(Graphics g)
Paint the text widget.
 o paint
  public void paint(Graphics g)
Paint the text widget.
Overrides:
paint in class Widget
 o x2pos
  public int x2pos(int x)
Convert an x coordinate into a text position.
 o handleEvent
  public boolean handleEvent(Event evt)
Handle mouse and character events.
Overrides:
handleEvent in class TextWidget
 o action
  public void action()
Perform the default action.
Overrides:
action in class Widget

All Packages  Class Hierarchy  This Package  Previous  Next  Index