ewe.ui
Class TextMessage
java.lang.Object
ewe.ui.ControlBase
ewe.ui.Control
ewe.ui.mLabel
ewe.ui.MessageArea
ewe.ui.TextMessage
- All Implemented Interfaces:
- CellConstants, ControlConstants, EventListener, ImageRefresher, IScroll, ScrollClient, TimerProc, UIConstants
- public class TextMessage
- extends MessageArea
- implements ScrollClient
This displays static text with automatic word wrapping. If you want to get it
to size itself to fit the text exactly do the following.
Construct it with the intended text.
If it is going to be using a Font other than the standard Gui font, then set the font variable first.
Call setPreferredSize(width,-1) - specifying a fixed width (in pixels) and a negative height.
Now it will calculate the number of lines required to display the text and therefore calculate the preferred
height.
| Fields inherited from class ewe.ui.Control |
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y |
| Fields inherited from class ewe.ui.ControlBase |
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, pressPoint, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput |
| Fields inherited from interface ewe.ui.UIConstants |
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN |
| Fields inherited from interface ewe.ui.CellConstants |
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST |
| Fields inherited from interface ewe.ui.ControlConstants |
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown |
|
Method Summary |
protected void |
calculateSizes()
Override this to calculate the preferred, minimum and maximum size of your control. |
boolean |
canGo(int orientation,
int direction,
int position)
|
void |
doScroll(int which,
int action,
int value)
|
boolean |
fitToScreen(String text)
|
int |
getActual(int which)
|
int |
getCurrent(int which)
|
ScrollablePanel |
getScrollablePanel()
|
int |
getVisible(int which,
int forSize)
|
boolean |
needScrollBar(int which,
int forSize)
|
String[] |
oldSplitLines()
|
void |
resizeTo(int width,
int height)
This will change the width and height values. |
void |
setText(String txt)
|
String[] |
splitLines()
|
String[] |
splitLines(int width,
FontMetrics fm)
|
Control |
tryMessageArea(Control parent,
Font f,
String text,
MessageArea area)
|
void |
update()
|
boolean |
willFitIn(String text,
int maxWidth)
|
| Methods inherited from class ewe.ui.Control |
acceptsData, activate, addListener, addTimer, amOnTopFrame, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deactivate, defaultTo, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getNextKeyFocus, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getTag, getText, getToolTip, getWindow, gotFocus, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, lostFocus, make, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onControlEvent, onKeyEvent, onLabelPenEvent, onPaint, paintBackground, paintChildren, penDoubleClicked, penHeld, penPressed, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, repaintDataNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, restore, scrollAndRepaint, sendToListeners, set, setBorder, setCell, setClipObject, setControl, setCursor, setFixedSize, setFont, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPromptControl, setRect, setRect, setServer, setTag, setTags, setTextSize, setToolTip, show, shown, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFocus, takeFromClipboard, takePromptControl, testDim, ticked, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, updateData, willAcceptDrop, willShowFrame |
minXScroll
public int minXScroll
autoWrap
public boolean autoWrap
numLines
protected int numLines
widest
protected int widest
lineHeight
protected int lineHeight
TextMessage
public TextMessage(int rows,
int columns)
TextMessage
public TextMessage(String text)
setText
public void setText(String txt)
- Overrides:
setText in class MessageArea
update
public void update()
- Overrides:
update in class MessageArea
calculateSizes
protected void calculateSizes()
- Description copied from class:
Control
- Override this to calculate the preferred, minimum and maximum size of your control. This is only
called once unless the modifier flag AlwaysRecalculateSizes is true.
During the calculation you will set the variables preferredWidth, preferredHeight, etc. directly.
- Overrides:
calculateSizes in class mLabel
willFitIn
public boolean willFitIn(String text,
int maxWidth)
fitToScreen
public boolean fitToScreen(String text)
tryMessageArea
public Control tryMessageArea(Control parent,
Font f,
String text,
MessageArea area)
splitLines
public String[] splitLines()
- Overrides:
splitLines in class MessageArea
splitLines
public String[] splitLines(int width,
FontMetrics fm)
oldSplitLines
public String[] oldSplitLines()
resizeTo
public void resizeTo(int width,
int height)
- Description copied from class:
Control
- This will change the width and height values.
- Overrides:
resizeTo in class Control
getActual
public int getActual(int which)
- Specified by:
getActual in interface ScrollClient
getVisible
public int getVisible(int which,
int forSize)
- Specified by:
getVisible in interface ScrollClient
getCurrent
public int getCurrent(int which)
- Specified by:
getCurrent in interface ScrollClient
doScroll
public void doScroll(int which,
int action,
int value)
- Specified by:
doScroll in interface ScrollClient
getScrollablePanel
public ScrollablePanel getScrollablePanel()
needScrollBar
public boolean needScrollBar(int which,
int forSize)
- Specified by:
needScrollBar in interface ScrollClient
canGo
public boolean canGo(int orientation,
int direction,
int position)
- Specified by:
canGo in interface ScrollClient