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.
-
JDPRichText()
- Creates a new Rich Text class.
-
JDPRichText(JDPUser)
- Creates a new Rich Text class.
-
formatText()
- Format the text.
-
getBackground()
-
-
getForeground()
-
-
getSelectedText()
- Get the selected text
-
getSelectionEnd()
- Get the end point of the selected text
-
getSelectionStart()
- Get the starting point of the selected text
-
getText()
- Get the text value
-
getWrap()
- Get the current word wrapping setting
-
handleEvent(Event)
-
-
init()
- Initialise the class
-
insets()
-
-
isEditable()
- Check whether the text is editable or not
-
layout()
-
-
minimumSize()
-
-
paint(Graphics)
-
-
preferredSize()
-
-
replaceText(String, int, int)
- Replace text
-
select(int, int)
- Set the selected text
-
setBackground(Color)
-
-
setColors(Color[])
- Set the array that contains the Colors for the specified postions as set using
setPostions().
-
setEditable(boolean)
- Set whether the text is editable or not
-
setFonts(Font[])
- Set the array that contains the Fonts for the specified postions as set using
setPostions().
-
setForeground(Color)
-
-
setPostitions(int[])
- Set the array that contains the text postions where the fonts and colors change
-
setText(String)
- Set the text value
-
setWrap(boolean)
- Set the word wrapping setting
-
update(Graphics)
-
JDPRichText
public JDPRichText()
- Creates a new Rich Text class.
JDPRichText
public JDPRichText(JDPUser user)
- Creates a new Rich Text class.
- Parameters:
- JDPUser - the global user parameter used to pass handles in JDP.
init
public void init()
- Initialise the class
setText
public void setText(String thisText)
- Set the text value
- Parameters:
- text - the new text value
getText
public String getText()
- Get the text value
- Returns:
- the current text value
setBackground
public void setBackground(Color thisColor)
- Overrides:
- setBackground in class Component
getBackground
public Color getBackground()
- Overrides:
- getBackground in class Component
setForeground
public void setForeground(Color thisColor)
- Overrides:
- setForeground in class Component
getForeground
public Color getForeground()
- Overrides:
- getForeground in class Component
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.
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.
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.
setEditable
public void setEditable(boolean flag)
- Set whether the text is editable or not
- Parameters:
- editable - the editable status
isEditable
public boolean isEditable()
- Check whether the text is editable or not
- Returns:
- the editable status
getSelectionStart
public int getSelectionStart()
- Get the starting point of the selected text
- Returns:
- the starting point of the selected text
getSelectionEnd
public int getSelectionEnd()
- Get the end point of the selected text
- Returns:
- the end point of the selected text
getSelectedText
public String getSelectedText()
- Get the selected text
- Returns:
- the selected text
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
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
setWrap
public void setWrap(boolean wrapOn)
- Set the word wrapping setting
- Parameters:
- wrapOn - the new word wrapping setting
getWrap
public boolean getWrap()
- Get the current word wrapping setting
- Parameters:
- wrapOn - the current word wrapping setting
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.
insets
public Insets insets()
- Overrides:
- insets in class Container
layout
public void layout()
- Overrides:
- layout in class Container
paint
public void paint(Graphics g)
- Overrides:
- paint in class Container
update
public synchronized void update(Graphics g)
- Overrides:
- update in class Component
handleEvent
public synchronized boolean handleEvent(Event e)
- Overrides:
- handleEvent in class Component
preferredSize
public Dimension preferredSize()
- Overrides:
- preferredSize in class Container
minimumSize
public Dimension minimumSize()
- Overrides:
- minimumSize in class Container