|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Canvas wyvern.common.util.TextDisplay
A super-lightweight replacement for java.awt.TextArea that lets you change the font + color for each line you append. Read-only, append-only. Supports line-wrap. Only supports a single font size and style for the entire document. You should normally use a wyvern.common.util.ColorTextArea, which maintains a TextDisplay in a ScrollPane.
Nested Class Summary |
Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
TextDisplay(java.awt.Frame frame,
ColorTextArea parent)
Constructs a new TextDisplay within a ColorTextArea. |
Method Summary | |
void |
addDisplayLine(wyvern.common.util.TextDisplay.Line line)
Adds a display line, nuking any linefeeds, since they show up as weird characters on the handhelds. |
void |
append(java.lang.String text)
Appends a string in black. |
void |
append(java.lang.String text,
java.awt.Color color)
Appends text in the specified color. |
void |
checkLinefeeds(wyvern.common.util.TextDisplay.Line line)
Breaks a complete line at linefeeds. |
int |
chopLine(java.lang.String text,
java.awt.FontMetrics fm,
int width)
Chops a line mid-word. |
static void |
debug(java.lang.String msg)
Prints debugging message. |
void |
drawBackgroundImage(java.awt.Graphics g)
Tiles the background image into the text area. |
void |
ensureBuffers()
Makes sure our buffer is the size of our bounds. |
int |
getDisplayLines()
Returns the number of display lines in our history buffer. |
java.awt.Dimension |
getMinimumSize()
Returns minimum size. |
java.awt.Dimension |
getPreferredSize()
Returns preferred size. |
int |
getVisibleLines()
Returns the number of lines we can see on the screen in the given font. |
void |
paint(java.awt.Graphics g)
Draws the text. |
void |
resetBounds()
Redoes our geometry. |
void |
rewrapLines()
Recomputes the display lines from the text lines. |
void |
setBackground(java.awt.Color color)
Sets background color. |
void |
setBackgroundImage(java.awt.Image img)
Sets background |
void |
setFont(java.awt.Font f)
Sets a new font, re-wrapping the lines. |
void |
setMaxLines(int lines)
Sets the maximum number of lines we'll display before starting to remove them from the top. |
void |
setScrollPosition(int line)
Sets the display line we're currently scrolled to. |
void |
setText(java.lang.String text)
Replaces the text. |
void |
setText(java.lang.String text,
java.awt.Color color)
Replaces all the text with a new string in the specified color. |
void |
update(java.awt.Graphics g)
Avoids flicker. |
void |
wrapLine(wyvern.common.util.TextDisplay.Line line)
Wraps a single line of text to fit in the display. |
Methods inherited from class java.awt.Canvas |
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TextDisplay(java.awt.Frame frame, ColorTextArea parent)
Method Detail |
public void setMaxLines(int lines)
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension getPreferredSize()
public void setBackground(java.awt.Color color)
public void setBackgroundImage(java.awt.Image img)
public void setFont(java.awt.Font f)
public void append(java.lang.String text)
public void append(java.lang.String text, java.awt.Color color)
public void resetBounds()
public void ensureBuffers()
public void setScrollPosition(int line)
public void setText(java.lang.String text)
public void setText(java.lang.String text, java.awt.Color color)
public void wrapLine(wyvern.common.util.TextDisplay.Line line)
public int chopLine(java.lang.String text, java.awt.FontMetrics fm, int width)
public void checkLinefeeds(wyvern.common.util.TextDisplay.Line line)
public void addDisplayLine(wyvern.common.util.TextDisplay.Line line)
public void rewrapLines()
public void update(java.awt.Graphics g)
public void paint(java.awt.Graphics g)
public void drawBackgroundImage(java.awt.Graphics g)
public int getDisplayLines()
public int getVisibleLines()
public static void debug(java.lang.String msg)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |