: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw
Class LwTextField

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.LwLabel
              |
              +--org.zaval.lw.LwTextField
All Implemented Interfaces:
Cursorable, java.util.EventListener, Layoutable, LwComponent, LwFocusListener, LwKeyListener, LwMouseListener, LwMouseMotionListener, PosInfo, PosListener, ScrollObj, TxtSelectionInfo, Validationable
Direct Known Subclasses:
LwMaskTextField

public class LwTextField
extends LwLabel
implements LwKeyListener, LwMouseListener, LwMouseMotionListener, LwFocusListener, Cursorable, PosInfo, PosListener, ScrollObj, TxtSelectionInfo

This class is a text field component. The library provides several text renders implementations that can be used as a face view of the component:

  • LwTextRender. This text render is used as default text render. It allows rendering text and selected text part
  • LwPasswordText. This text render is used for password text fields. The sample below shows the render usage:
            ...
            LwTextFiled tf = new LwTextFiled("Password text");
            tf.getViewMan(true).setView(new LwPasswordText(tf.getText()));
            ...
         

The list below describes some features of the component:

  • Use the following code to organize single line text field component with a fixed number of characters
            ...
            // Creates single line text field component, where it is possible to
            // enter at most 10 characters.
            LwTextFiled tf = new LwTextFiled("", 10);
            ...
         
  • Use setPSByRowsCols method to define preferred size of the component basing on the number of rows and columns. The method calculates and sets preferred size of the text field component according to its row size and column size. Draw attention that if the font has been redefined for the text render, than it is necessary to call the method again to recalculate his preferred size.
  • It is possible to redefined text cursor view by setCursorView method.
  • It is possible to define another pos controller by setPosController method to control text cursor position.
  • Use setEditable method to define if a text can be edited or not.
  • Use getSelectedText method to get selected text.

The component overrides the getOrigin method to organize scrolling of the content. The scrolling mechanism works right if the component will be inserted into a LwScrollPan component.

To listen when the cursor position has been changed use the pos controller as follow:

   public class Sample
   implements PosListener
   {
     ...
     public void init()
     {
       ...
       LwTextFiled tf = new LwTextFiled("Text");
       tf.getPosController().addPosListener(this);
       ...
     }
     public void posChanged(Object target, int po, int pl, int pc) {
       System.out.println("The old cursor location is - " + po);
     }
   }
 


Fields inherited from class org.zaval.lw.LwCanvas
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y
 
Constructor Summary
LwTextField()
          Constructs a text filed component with no text.
LwTextField(java.lang.String s)
          Constructs a text field component with the specified text.
LwTextField(java.lang.String s, int maxCol)
          Constructs a single line text field component with the specified text and the maximal number of columns.
LwTextField(TextModel model)
          Constructs a text field component with the specified text model.
 
Method Summary
 boolean canHaveFocus()
          Specifies if the component can have focus.
 void clearSelection()
          Clears selection
protected  void drawCursor(java.awt.Graphics g)
          The method is used to paint the text cursor using the cursor view.
 void endDragged(LwMouseEvent e)
          Invoked when the mouse ends dragged.
static java.awt.Point findNextWord(TextModel t, int line, int col, int d)
          Finds starting from the specified line and column next word in the given text model and returns the found word location.
 void focusGained(LwVCLEvent e)
          Invoked when the light weight component gained focus.
 void focusLost(LwVCLEvent e)
          Invoked when the light weight component lost focus.
 int getCursorType(LwComponent target, int x, int y)
          Gets the cursor type for the specified location of the given component.
 LwView getCursorView()
          Gets the cursor view that is used to paint the text cursor.
 java.awt.Point getEndSelection()
          Returns the last selection row and column
 int getLines()
          Gets the number of lines.
 int getLineSize(int i)
          Gets the line size for the specified line number.
 int getMaxOffset()
          Gets the maximal offset.
 java.awt.Point getOrigin()
          Returns an origin of the component.
 PosController getPosController()
          Gets the pos controller that manages the text cursor position.
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of this component.
 java.awt.Color getSelectColor()
          Returns the color that is used to render selected text background.
 java.lang.String getSelectedText()
          Returns the selected text.
 java.awt.Point getSelectionOffsets()
          Gets the start and last selection offsets.
 java.awt.Point getSOLocation()
          Gets the scroll object location.
 java.awt.Dimension getSOSize()
          Gets the scroll object size.
 java.awt.Point getStartSelection()
          Returns the start selection row and column
static java.lang.String getSubString(LwTextRender r, java.awt.Point start, java.awt.Point end)
          Returns a substring of the specified text render, at the given start and last position.
static java.awt.Point getTextLocationAt(LwTextRender render, PosController pos)
          Calculates and gets a pixel location for the specified text render and the text cursor position.
static java.awt.Point getTextRowColAt(LwTextRender render, int x, int y)
          Calculates and gets a text position for the specified text render and the location.
protected  void handleKey(LwKeyEvent e)
          Handles the specified key event.
 boolean hasSelection()
          Tests if the a text part has been selected.
 boolean isEditable()
          Checks if the text field component is editable.
protected  boolean isFiltered(LwKeyEvent e)
          Returns true if the key event should be handle next, returns false if the handling process has to be terminated.
 void keyPressed(LwKeyEvent e)
          Invoked when a key has been pressed.
 void keyReleased(LwKeyEvent e)
          Invoked when a key has been released.
 void keyTyped(LwKeyEvent e)
          Invoked when a key has been typed.
 void mouseClicked(LwMouseEvent e)
          Invoked when the mouse button has been clicked on a light weight component.
 void mouseDragged(LwMouseEvent e)
          Invoked when a mouse button is pressed on a component and then dragged.
 void mouseEntered(LwMouseEvent e)
          Invoked when the mouse enters a light weight component.
 void mouseExited(LwMouseEvent e)
          Invoked when the mouse exits a light weight component.
 void mouseMoved(LwMouseEvent e)
          Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down).
 void mousePressed(LwMouseEvent e)
          Invoked when the mouse button has been pressed on a light weight component.
 void mouseReleased(LwMouseEvent e)
          Invoked when the mouse button has been released on a light weight component.
 boolean moveContent()
          Tests if the scroll component performs scrolling by changing it location or view.
protected  int pageSize()
          Gets the page size.
 void paint(java.awt.Graphics g)
          Paints this component.
 void posChanged(java.lang.Object target, int po, int pl, int pc)
          Invoked when a virtual position has been changed.
protected  void recalc()
          Invoked with validate method only if the component is not valid.
 void remove(int pos, int size)
          Removes a part of the text starting from the given position and with the specified size.
 void repaint(boolean b)
          Invoked whenever the component got or lost the focus.
 void select(int startOffset, int endOffset)
          Selects the specified by the start and end offsets the text part.
 void setCursorView(LwView v)
          Sets the specified cursor view to render the text cursor.
 void setEditable(boolean b)
          Sets the specified mode for the text field component.
 void setEnabled(boolean b)
          Enables or disables this component.
 void setPosController(PosController p)
          Sets the specified pos controller to manage the text cursor position.
 void setPSByRowsCols(int r, int c)
          Sets the preferred size for the text field component that conforms to the specified number of rows and columns.
 void setScrollMan(ScrollMan m)
          Sets the specified scroll manager for the scroll object.
 void setSelectColor(java.awt.Color c)
          Sets the specified color to render selected text.
 void setSOLocation(int x, int y)
          Sets the specified scroll object location.
 void setText(java.lang.String s)
          Sets the specified string to be shown with the class.
 void startDragged(LwMouseEvent e)
          Invoked when the mouse starts dragged.
 void write(int pos, java.lang.String s)
          Inserts the specified text at the given position.
 
Methods inherited from class org.zaval.lw.LwLabel
getForeground, getText, getTextModel, getTextRender, setForeground
 
Methods inherited from class org.zaval.lw.LwCanvas
calcInsets, calcPreferredSize, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwComponentAt, getLwParent, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isOpaque, isValid, isVisible, repaint, repaint, requestFocus, setBackground, setInsets, setLocation, setLwParent, setOpaque, setPSSize, setSize, setViewMan, setVisible, update, validate, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.TxtSelectionInfo
getBackground
 

Constructor Detail

LwTextField

public LwTextField()
Constructs a text filed component with no text.

LwTextField

public LwTextField(java.lang.String s)
Constructs a text field component with the specified text. The methods sets LwTextRender as the face view and sets org.zaval.data.Text as the render target.
Parameters:
s - the specified text.

LwTextField

public LwTextField(java.lang.String s,
                   int maxCol)
Constructs a single line text field component with the specified text and the maximal number of columns.
Parameters:
s - the specified text.
maxCol - the specified maximal number of columns.

LwTextField

public LwTextField(TextModel model)
Constructs a text field component with the specified text model.
Parameters:
model - the specified text model.
Method Detail

canHaveFocus

public boolean canHaveFocus()
Description copied from interface: LwComponent
Specifies if the component can have focus.
Overrides:
canHaveFocus in class LwCanvas
Following copied from interface: org.zaval.lw.LwComponent
Returns:
true if the component can have the focus.

getPosController

public PosController getPosController()
Gets the pos controller that manages the text cursor position.
Returns:
a pos controller.

setPosController

public void setPosController(PosController p)
Sets the specified pos controller to manage the text cursor position.
Parameters:
p - the specified pos controller.

getCursorView

public LwView getCursorView()
Gets the cursor view that is used to paint the text cursor.
Returns:
a cursor view.

setCursorView

public void setCursorView(LwView v)
Sets the specified cursor view to render the text cursor.
Parameters:
v - the specified cursor view.

setPSByRowsCols

public void setPSByRowsCols(int r,
                            int c)
Sets the preferred size for the text field component that conforms to the specified number of rows and columns.
Parameters:
r - the specified number of rows.
c - the specified number of columns.

paint

public void paint(java.awt.Graphics g)
Paints this component. The method initiates painting of the cursor caret by calling drawCursor method.
Overrides:
paint in class LwCanvas
Parameters:
g - the graphics context to be used for painting.

setEditable

public void setEditable(boolean b)
Sets the specified mode for the text field component. The component is editable if it is possible to edit a text.
Parameters:
b - the specified mode. If the mode is true than the component is editable; otherwise not-editable.

isEditable

public boolean isEditable()
Checks if the text field component is editable.
Returns:
true if the text field is editable; false otherwise.

keyPressed

public void keyPressed(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been pressed.
Specified by:
keyPressed in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

keyTyped

public void keyTyped(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been typed.
Specified by:
keyTyped in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

focusGained

public void focusGained(LwVCLEvent e)
Description copied from interface: LwFocusListener
Invoked when the light weight component gained focus.
Specified by:
focusGained in interface LwFocusListener
Following copied from interface: org.zaval.lw.event.LwFocusListener
Parameters:
e - the specified focus event.

focusLost

public void focusLost(LwVCLEvent e)
Description copied from interface: LwFocusListener
Invoked when the light weight component lost focus.
Specified by:
focusLost in interface LwFocusListener
Following copied from interface: org.zaval.lw.event.LwFocusListener
Parameters:
e - the specified focus event.

keyReleased

public void keyReleased(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been released.
Specified by:
keyReleased in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

mouseClicked

public void mouseClicked(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse button has been clicked on a light weight component.
Specified by:
mouseClicked in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseEntered

public void mouseEntered(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse enters a light weight component.
Specified by:
mouseEntered in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseExited

public void mouseExited(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse exits a light weight component.
Specified by:
mouseExited in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

startDragged

public void startDragged(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when the mouse starts dragged.
Specified by:
startDragged in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

endDragged

public void endDragged(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when the mouse ends dragged.
Specified by:
endDragged in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

mouseReleased

public void mouseReleased(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse button has been released on a light weight component.
Specified by:
mouseReleased in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseMoved

public void mouseMoved(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down).
Specified by:
mouseMoved in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

mouseDragged

public void mouseDragged(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when a mouse button is pressed on a component and then dragged. Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).
Specified by:
mouseDragged in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

mousePressed

public void mousePressed(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse button has been pressed on a light weight component.
Specified by:
mousePressed in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

getCursorType

public int getCursorType(LwComponent target,
                         int x,
                         int y)
Gets the cursor type for the specified location of the given component. The method returns Cursor.TEXT_CURSOR cursor type.
Specified by:
getCursorType in interface Cursorable
Parameters:
target - the given component.
x - the x coordinate.
y - the y coordinate.
Returns:
a cursor type.

getLineSize

public int getLineSize(int i)
Description copied from interface: PosInfo
Gets the line size for the specified line number.
Specified by:
getLineSize in interface PosInfo
Following copied from interface: org.zaval.misc.PosInfo
Parameters:
line - the specified line number.
Returns:
a size of the line.

getLines

public int getLines()
Description copied from interface: PosInfo
Gets the number of lines.
Specified by:
getLines in interface PosInfo
Following copied from interface: org.zaval.misc.PosInfo
Returns:
a number of lines.

getMaxOffset

public int getMaxOffset()
Description copied from interface: PosInfo
Gets the maximal offset. The method can return -1 as the result, in this case the pos controller that uses the pos info will try to calculate the maximal offset itself basing on the line number and the lines sizes.
Specified by:
getMaxOffset in interface PosInfo
Following copied from interface: org.zaval.misc.PosInfo
Returns:
a maximal offset.

setText

public void setText(java.lang.String s)
Description copied from class: LwLabel
Sets the specified string to be shown with the class.
Overrides:
setText in class LwLabel
Following copied from class: org.zaval.lw.LwLabel
Parameters:
s - the specified string.

posChanged

public void posChanged(java.lang.Object target,
                       int po,
                       int pl,
                       int pc)
Description copied from interface: PosListener
Invoked when a virtual position has been changed.
Specified by:
posChanged in interface PosListener
Following copied from interface: org.zaval.misc.event.PosListener
Parameters:
target - the specified pos controller.
prevOffset - the previous offset.
prevLine - the previous line.
prevColumn - the previous column.

getOrigin

public java.awt.Point getOrigin()
Returns an origin of the component. The method is overridden with the component to offset a content of the text field depending on the cursor position.
Overrides:
getOrigin in class LwCanvas
Returns:
an origin of the component.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: LwCanvas
Gets the preferred size of this component. The method computes the preferred size as a sum of the component insets (returned with getInsets method) and a "pure" preferred size (returned with calcPreferredSize method). You should not override the method, use calcPreferredSize method to define the "pure" preferred size of this component.
Overrides:
getPreferredSize in class LwCanvas
Following copied from class: org.zaval.lw.LwCanvas
Returns:
a dimension object indicating this component preferred size.

getSOLocation

public java.awt.Point getSOLocation()
Description copied from interface: ScrollObj
Gets the scroll object location.
Specified by:
getSOLocation in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
a scroll object location.

setSOLocation

public void setSOLocation(int x,
                          int y)
Description copied from interface: ScrollObj
Sets the specified scroll object location. The method defines a mechanism that will be used to scrool the object.
Specified by:
setSOLocation in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
x - the specified x coordinate.
y - the specified y coordinate.

getSOSize

public java.awt.Dimension getSOSize()
Description copied from interface: ScrollObj
Gets the scroll object size. The size is a size that the scroll object wants to have.
Specified by:
getSOSize in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
a scroll object size.

setScrollMan

public void setScrollMan(ScrollMan m)
Description copied from interface: ScrollObj
Sets the specified scroll manager for the scroll object. The manager reference should be stored and used by the scrolled object to move itself inside the scrolled area.
Specified by:
setScrollMan in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
m - the specified scroll manager.

moveContent

public boolean moveContent()
Tests if the scroll component performs scrolling by changing it location or view. The method is overridden with the component to point move a content of the text field, the method always returns true.
Specified by:
moveContent in interface ScrollObj
Returns:
true if the scroll component organizes scrolling by moving its view; otherwise false.

getStartSelection

public java.awt.Point getStartSelection()
Description copied from interface: TxtSelectionInfo
Returns the start selection row and column
Specified by:
getStartSelection in interface TxtSelectionInfo
Following copied from interface: org.zaval.lw.TxtSelectionInfo
Returns:
a start selection row and column. The result is represented using java.awt.Point class where x field is selection row and y field is selection column. Returns null as the result if no any text portion has been selected.

getEndSelection

public java.awt.Point getEndSelection()
Description copied from interface: TxtSelectionInfo
Returns the last selection row and column
Specified by:
getEndSelection in interface TxtSelectionInfo
Following copied from interface: org.zaval.lw.TxtSelectionInfo
Returns:
a last selection row and column. The result is represented using java.awt.Point class where x field is selection row and y field is selection column. Returns null as the result if no any text portion has been selected.

hasSelection

public boolean hasSelection()
Tests if the a text part has been selected.
Returns:
true if the text part has been selected; false otherwise.

getSelectionOffsets

public java.awt.Point getSelectionOffsets()
Gets the start and last selection offsets.
Returns:
the start and last selection offsets. The result is represented with java.awt.Point class where x field corresponds to start selection offset and y field corresponds to last selection offset. The method returns null if no text part has been selected.

getSelectedText

public java.lang.String getSelectedText()
Description copied from interface: TxtSelectionInfo
Returns the selected text.
Specified by:
getSelectedText in interface TxtSelectionInfo
Following copied from interface: org.zaval.lw.TxtSelectionInfo
Returns:
a selected text. The method returns null if there is not selected text.

getSelectColor

public java.awt.Color getSelectColor()
Description copied from interface: TxtSelectionInfo
Returns the color that is used to render selected text background.
Specified by:
getSelectColor in interface TxtSelectionInfo
Following copied from interface: org.zaval.lw.TxtSelectionInfo
Returns:
a color to render selected text background.

setSelectColor

public void setSelectColor(java.awt.Color c)
Sets the specified color to render selected text.
Parameters:
c - the specified color.

setEnabled

public void setEnabled(boolean b)
Description copied from class: LwCanvas
Enables or disables this component. An enabled component can participate in events handling and performing processes. Component is enabled initially by default. The method performs appropriate LwVCLEvent.
Overrides:
setEnabled in class LwCanvas
Following copied from class: org.zaval.lw.LwCanvas
Parameters:
b - if true, this component is enabled; otherwise this component is disabled.

select

public void select(int startOffset,
                   int endOffset)
Selects the specified by the start and end offsets the text part.
Parameters:
startOffset - the specified start offset.
endOffset - the specified end offset.

drawCursor

protected void drawCursor(java.awt.Graphics g)
The method is used to paint the text cursor using the cursor view.
Parameters:
g - the graphics context to be used for painting.

recalc

protected void recalc()
Description copied from class: LwCanvas
Invoked with validate method only if the component is not valid. The method should be overridden to calculate metrical characteristics of the component to minimize computation time of the preferred size for the component. For example, you can calculate a preferred size inside the method and just return it by calcPreferredSize method.
Overrides:
recalc in class LwCanvas

handleKey

protected void handleKey(LwKeyEvent e)
Handles the specified key event.
Parameters:
e - the specified key event to be handle.

isFiltered

protected boolean isFiltered(LwKeyEvent e)
Returns true if the key event should be handle next, returns false if the handling process has to be terminated. The method is called before any other event handler will be executed.
Parameters:
e - the specified key event.
Returns:
true if the key event should be handled.

remove

public void remove(int pos,
                   int size)
Removes a part of the text starting from the given position and with the specified size.
Parameters:
pos - the given position.
size - the specified removed part size.

write

public void write(int pos,
                  java.lang.String s)
Inserts the specified text at the given position.
Parameters:
pos - the given position.
s - the specified text to be inserted.

pageSize

protected int pageSize()
Gets the page size.
Returns:
a page size.

repaint

public void repaint(boolean b)
Description copied from interface: LwComponent
Invoked whenever the component got or lost the focus. The method is supposed to optimize the performance of the focus marker, since in most cases it is not necessary to repaint all component area. By default the method repaint all component area.
Overrides:
repaint in class LwCanvas
Following copied from interface: org.zaval.lw.LwComponent
Parameters:
b - true if the component has got the focus, and false if the component lost the focus.

clearSelection

public void clearSelection()
Clears selection

getTextLocationAt

public static java.awt.Point getTextLocationAt(LwTextRender render,
                                               PosController pos)
Calculates and gets a pixel location for the specified text render and the text cursor position.
Parameters:
render - the specified text render.
pos - the pos controller that defines the text position.
Returns:
a pixel location.

getTextRowColAt

public static java.awt.Point getTextRowColAt(LwTextRender render,
                                             int x,
                                             int y)
Calculates and gets a text position for the specified text render and the location. The result is represented with java.awt.Point class where x field defines a row and y field defines a column.
Parameters:
render - the specified text render.
x - the x coordinate of the location.
y - the y coordinate of the location.
Returns:
a text position.

findNextWord

public static java.awt.Point findNextWord(TextModel t,
                                          int line,
                                          int col,
                                          int d)
Finds starting from the specified line and column next word in the given text model and returns the found word location. The result is represented with java.awt.Point object where x field defines a row text position and y field defines a column text position.
Parameters:
t - the specified text model.
line - the specified starting line.
col - the specified starting column.
d - the specified searching direction. If the value is 1 than the method looks for a next word location, if the value is -1 than the method looks for a previous word location.
Returns:
a word location.

getSubString

public static java.lang.String getSubString(LwTextRender r,
                                            java.awt.Point start,
                                            java.awt.Point end)
Returns a substring of the specified text render, at the given start and last position. The positions are represented with java.awt.Point object where x field defines a row and y field defines a column.
Parameters:
r - the specified text render.
start - the specified start position.
end - the specified last position.
Returns:
a substring.


: up