|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.ui.wombat.Component jcontrol.ui.wombat.AbstractFocusComponent jcontrol.ui.wombat.AbstractScrolledComponent jcontrol.ui.wombat.TextViewer
public class TextViewer
This class TextViewer
implements a component to show a text document.
Line wrapping is done automatically. If a line's text width exceeds the TextViewer's displayable width the
text will be cut.
The text can only be scrolled vertically.
(c) Copyright 2005-2007 DOMOLOGIC GmbH
Field Summary | |
---|---|
static int |
STYLE_NONE
Style constant for neither border nor scrollbar look. |
static int |
STYLE_SHOW_BORDER
Style constant for a bordered look. |
static int |
STYLE_SHOW_SCROLLBAR
Style constant for a bordered look with scrollbar. |
Fields inherited from class jcontrol.ui.wombat.AbstractScrolledComponent |
---|
m_fontHeight, m_scrollBarSize, m_scrollValue |
Fields inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
BORDER_WIDTH, listener |
Fields inherited from interface jcontrol.ui.wombat.IFocusable |
---|
TRANSFER_FOCUS_BACKWARD, TRANSFER_FOCUS_FORWARD |
Fields inherited from interface jcontrol.ui.wombat.event.TouchListener |
---|
RESULT_ACCEPTED, RESULT_EXECUTED, RESULT_NONE |
Constructor Summary | |
---|---|
TextViewer(int x,
int y,
int width,
int height,
int style)
Constructor for TextViewer. |
|
TextViewer(String text,
int x,
int y,
int width,
int height,
int style)
Constructor for TextViewer. |
Method Summary | |
---|---|
void |
add(String text)
Append a text to the end of the text field. |
int |
getLineCount()
Returns the number of lines in this TextViewer. |
int |
getScrollValue()
Returns the current scroll value. |
KeyEvent |
onKeyEvent(KeyEvent e)
Handle KeyEvents. |
int |
onTouchEvent(TouchEvent e)
Handle TouchEvent. |
void |
paint(XGraphics g)
Paint this text field. |
void |
setBounds(int x,
int y,
int width,
int height)
Set the dimensions of this component. |
void |
setFont(Resource font)
Sets the font for this component. |
void |
setScrollValue(int scrollValue)
Sets the absolute scroll position of the text area. |
void |
setText(String text)
Replaces the current text by the given string. |
protected void |
validateBreakPoints(XGraphics g)
|
Methods inherited from class jcontrol.ui.wombat.AbstractScrolledComponent |
---|
drawScrollBar |
Methods inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
clearCorners, drawBevelRect, drawButton, drawDottedRect, drawFocusRect, getActionListener, onActionEvent, requestFocus, setActionListener, setEnabled, setVisible |
Methods inherited from class jcontrol.ui.wombat.Component |
---|
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, redrawInternalAndParent, repaint, repaintAll, safeExec, setBackgroundColor, setBackgroundColorInternal, setDirty, setForegroundColor, setForegroundColorInternal, setParametersInternal, setRedraw, setTransparentColor, unsafeExec, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
public static final int STYLE_NONE
public static final int STYLE_SHOW_BORDER
public static final int STYLE_SHOW_SCROLLBAR
Constructor Detail |
---|
public TextViewer(String text, int x, int y, int width, int height, int style)
text
- The text document to showx
- The x coordinate on the display.y
- The y coordinate on the display.width
- The text field width.height
- The text field height.style
- STYLE_NONE or STYLE_SHOW_BORDER or STYLE_SHOW_SCROLLBARpublic TextViewer(int x, int y, int width, int height, int style)
x
- The x coordinate on the display.y
- The y coordinate on the display.width
- The text field width.height
- The text field height.style
- STYLE_NONE or STYLE_SHOW_BORDER or STYLE_SHOW_SCROLLBARMethod Detail |
---|
public void add(String text)
item
- The text to add.public void setText(String text)
text
- a new text to show.public int getLineCount()
public void setScrollValue(int scrollValue)
scrollValue
- The new scroll position.public int getScrollValue()
protected void validateBreakPoints(XGraphics g)
public void setBounds(int x, int y, int width, int height)
setBounds
in class Component
x
- The x-coordinate of the upper left cornery
- The y-coordinate of the upper left cornerwidth
- The width of this componentheight
- The height of this componentpublic void setFont(Resource font)
setFont
in class Component
font
- the new font.public void paint(XGraphics g)
paint
in class Component
g
- the application's graphics object.public KeyEvent onKeyEvent(KeyEvent e)
onKeyEvent
in interface KeyListener
onKeyEvent
in class AbstractFocusComponent
e
- the event that contains information about the key.
null
if the KeyEvent has been consumed by the KeyListener,public int onTouchEvent(TouchEvent e)
onTouchEvent
in interface TouchListener
onTouchEvent
in class AbstractFocusComponent
e
- The touch event.
RESULT_ACCEPTED
if the TouchEvent has been consumed by the TouchListener,RESULT_EXECUTED
if the TouchEvent has been consumed by the TouchListener and some important action has been performed, e.g. an action event has been invoked,RESULT_NONE
if the TouchEvent should be passed on to the next TouchListener.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |