Class JDPRichText

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----JDPRichText

public class JDPRichText
extends Panel
Class JDPRichText represents a rich text class that allows wrapping and mixed fonts.


Constructor Index

 o JDPRichText()
Creates a new Rich Text class.
 o JDPRichText(JDPUser)
Creates a new Rich Text class.

Method Index

 o formatText()
Format the text.
 o getBackground()
 o getForeground()
 o getSelectedText()
Get the selected text
 o getSelectionEnd()
Get the end point of the selected text
 o getSelectionStart()
Get the starting point of the selected text
 o getText()
Get the text value
 o getWrap()
Get the current word wrapping setting
 o handleEvent(Event)
 o init()
Initialise the class
 o insets()
 o isEditable()
Check whether the text is editable or not
 o layout()
 o minimumSize()
 o paint(Graphics)
 o preferredSize()
 o replaceText(String, int, int)
Replace text
 o select(int, int)
Set the selected text
 o setBackground(Color)
 o setColors(Color[])
Set the array that contains the Colors for the specified postions as set using setPostions().
 o setEditable(boolean)
Set whether the text is editable or not
 o setFonts(Font[])
Set the array that contains the Fonts for the specified postions as set using setPostions().
 o setForeground(Color)
 o setPostitions(int[])
Set the array that contains the text postions where the fonts and colors change
 o setText(String)
Set the text value
 o setWrap(boolean)
Set the word wrapping setting
 o update(Graphics)

Constructors

 o JDPRichText
 public JDPRichText()
Creates a new Rich Text class.

 o JDPRichText
 public JDPRichText(JDPUser user)
Creates a new Rich Text class.

Parameters:
JDPUser - the global user parameter used to pass handles in JDP.

Methods

 o init
 public void init()
Initialise the class

 o setText
 public void setText(String thisText)
Set the text value

Parameters:
text - the new text value
 o getText
 public String getText()
Get the text value

Returns:
the current text value
 o setBackground
 public void setBackground(Color thisColor)
Overrides:
setBackground in class Component
 o getBackground
 public Color getBackground()
Overrides:
getBackground in class Component
 o setForeground
 public void setForeground(Color thisColor)
Overrides:
setForeground in class Component
 o getForeground
 public Color getForeground()
Overrides:
getForeground in class Component
 o setPostitions
 public void setPostitions(int thisPositions[])
Set the array that contains the text postions where the fonts and colors change

Parameters:
positions - an array containing integers that represent the character postions in the current text where the fonts and colors change. This corresponds with the Fonts and Colors arrays.
 o setFonts
 public void setFonts(Font thisFonts[])
Set the array that contains the Fonts for the specified postions as set using setPostions().

Parameters:
fonts - an array containing fonts that represent the font of the current text for the specified postions.
 o setColors
 public void setColors(Color thisColors[])
Set the array that contains the Colors for the specified postions as set using setPostions().

Parameters:
fonts - an array containing colors that represent the color of the current text for the specified postions.
 o setEditable
 public void setEditable(boolean flag)
Set whether the text is editable or not

Parameters:
editable - the editable status
 o isEditable
 public boolean isEditable()
Check whether the text is editable or not

Returns:
the editable status
 o getSelectionStart
 public int getSelectionStart()
Get the starting point of the selected text

Returns:
the starting point of the selected text
 o getSelectionEnd
 public int getSelectionEnd()
Get the end point of the selected text

Returns:
the end point of the selected text
 o getSelectedText
 public String getSelectedText()
Get the selected text

Returns:
the selected text
 o select
 public void select(int from,
                    int to)
Set the selected text

Parameters:
selectedFrom - the selected text starting point
selectedTo - the selected text end point
 o replaceText
 public void replaceText(String thisText,
                         int from,
                         int to)
Replace text

Parameters:
newText - the new text to put in place of the old text
From - the starting point of the text to replace
To - the end point of the text to replace
 o setWrap
 public void setWrap(boolean wrapOn)
Set the word wrapping setting

Parameters:
wrapOn - the new word wrapping setting
 o getWrap
 public boolean getWrap()
Get the current word wrapping setting

Parameters:
wrapOn - the current word wrapping setting
 o formatText
 public synchronized void formatText()
Format the text. This method can be overridden to implement classes as color coded text. This can be done by analyzing the current text and setting new values for the Fonts and colors arrays before repainting the text.

 o insets
 public Insets insets()
Overrides:
insets in class Container
 o layout
 public void layout()
Overrides:
layout in class Container
 o paint
 public void paint(Graphics g)
Overrides:
paint in class Container
 o update
 public synchronized void update(Graphics g)
Overrides:
update in class Component
 o handleEvent
 public synchronized boolean handleEvent(Event e)
Overrides:
handleEvent in class Component
 o preferredSize
 public Dimension preferredSize()
Overrides:
preferredSize in class Container
 o minimumSize
 public Dimension minimumSize()
Overrides:
minimumSize in class Container