jewl
Class MultiLineControl

java.lang.Object
  extended byjewl.Window
      extended byjewl.Control
          extended byjewl.MultiLineControl
Direct Known Subclasses:
ComboBox, ListBox, Memo

public abstract class MultiLineControl
extends Control

The abstract base class for controls containing multiple lines of text. Multi-line controls allow you to get or set the text of any line in the control, and to insert and remove items. The user or the program can select any line using the select() method, and several other methods implicitly operate on the currently selected line.


Method Summary
 void appendLine(java.lang.String text)
          Append a new line to the end of this control.
 void appendLines(java.lang.String[] text)
          Append a set of lines to the end of this control.
abstract  void clear()
          Remove all lines from this control.
 java.lang.String getLine()
          Get the text of the currently selected line.
abstract  java.lang.String getLine(int line)
          Get the text of the specified line.
 void insertLine(java.lang.String text)
          Insert a new line into this control immediately above the currently selected line.
abstract  void insertLine(java.lang.String text, int line)
          Insert a new line into this control immediately above the specified line.
 void insertLines(java.lang.String[] text)
          Insert a set of lines into this control immediately above the currently selected line.
 void insertLines(java.lang.String[] text, int line)
          Insert a set of lines into this control immediately above the specified line.
abstract  int lines()
          Get the number of lines in this control.
 void removeLine()
          Remove the currently selected line from this control.
abstract  void removeLine(int line)
          Remove the specified line from this control.
abstract  void select(int line)
          Select the specified line.
abstract  int selection()
          Get the number of the the currently selected line in this control.
 void setLine(java.lang.String text)
          Set the text of the currently selected line.
abstract  void setLine(java.lang.String text, int line)
          Set the text of the specified line.
 
Methods inherited from class jewl.Control
disable, enable, enable, getToolTip, isEnabled, setToolTip
 
Methods inherited from class jewl.Window
addEventListener, commandAvailable, getCommand, getFont, getHeight, getID, getLeft, getScreenHeight, getScreenWidth, getSource, getTop, getWidth, hide, init, isVisible, nextCommand, parent, root, setFont, setID, setLocation, setSize, show, show
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lines

public abstract int lines()
Get the number of lines in this control.

Returns:
The number of lines.

selection

public abstract int selection()
Get the number of the the currently selected line in this control.

Returns:
The number of the currently selected line, or -1 if no line has been selected.

select

public abstract void select(int line)
Select the specified line.

Parameters:
line - the number of the line to be selected as the current line.
Throws:
java.lang.ArrayIndexOutOfBoundsException - The line number is invalid.

getLine

public abstract java.lang.String getLine(int line)
Get the text of the specified line.

Parameters:
line - the number of the line to get.
Returns:
The text of the specified line.
Throws:
java.lang.ArrayIndexOutOfBoundsException - the line number is invalid.

getLine

public java.lang.String getLine()
Get the text of the currently selected line. This is the same as getLine(selection()).

Returns:
The text of the current line.
Throws:
java.lang.ArrayIndexOutOfBoundsException - there is no currently selected line.

setLine

public abstract void setLine(java.lang.String text,
                             int line)
Set the text of the specified line.

Parameters:
text - the text to be stored in the specified line.
line - the number of the line to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException - the line number is invalid.

setLine

public void setLine(java.lang.String text)
Set the text of the currently selected line. This is the same as setLine(text,selection()).

Parameters:
text - the text to be stored in the current line.
Throws:
java.lang.ArrayIndexOutOfBoundsException - there is no currently selected line.

insertLine

public abstract void insertLine(java.lang.String text,
                                int line)
Insert a new line into this control immediately above the specified line.

Parameters:
text - the text of the line to be inserted.
line - the line number where the new line should be inserted, or -1 to append the line to the end of the control.
Throws:
java.lang.ArrayIndexOutOfBoundsException - the line number is invalid.

insertLine

public void insertLine(java.lang.String text)
Insert a new line into this control immediately above the currently selected line. If there is no selected line, the new line is appended to the end of the control. This is the same as insertLine(text,selection()).

Parameters:
text - the text of the line to be inserted.

appendLine

public void appendLine(java.lang.String text)
Append a new line to the end of this control. This is the same as insertLine(text,-1).

Parameters:
text - the text of the line to be appended.

insertLines

public void insertLines(java.lang.String[] text,
                        int line)
Insert a set of lines into this control immediately above the specified line.

Parameters:
text - an array of lines to be inserted.
line - the line number where the new line should be inserted, or -1 to append the lines to the end of the control.
Throws:
java.lang.ArrayIndexOutOfBoundsException - the line number is invalid.

insertLines

public void insertLines(java.lang.String[] text)
Insert a set of lines into this control immediately above the currently selected line. If there is no selected line, the new lines are appended to the end of the control.

Parameters:
text - an array of lines to be inserted.

appendLines

public void appendLines(java.lang.String[] text)
Append a set of lines to the end of this control. This is equivalent to insertLines(text,-1).

Parameters:
text - an array of lines to be appended.

removeLine

public abstract void removeLine(int line)
Remove the specified line from this control.

Parameters:
line - the number of the line to be removed, or -1 to remove the currently selected line.
Throws:
java.lang.ArrayIndexOutOfBoundsException - the line number is invalid.

removeLine

public void removeLine()
Remove the currently selected line from this control.

Throws:
java.lang.ArrayIndexOutOfBoundsException - if there is no currently selected line.

clear

public abstract void clear()
Remove all lines from this control.