com.lyrisoft.awt
Class TextView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.lyrisoft.awt.TextView
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
HyperlinkTextView

public class TextView
extends java.awt.Canvas

An alternative TextView (non-editable) that allows font colors, sytles, and word-wrap. Works in JDK1.0.2

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  TextStyle _defaultStyle
           
protected  int _firstRun
           
protected  java.util.Vector _runs
           
protected  int _yTranslation
           
static java.awt.Font DEFAULT_FONT
           
 
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
TextView()
          Construct a new scrollview that does not auto-scroll
TextView(boolean autoScrolling)
          Construct a new scrollview
 
Method Summary
 void append(java.lang.String s)
          Append a string in the default style
 void append(java.lang.String s, TextStyle style)
          Append a string using the given TextStyle
 void append(TextRun run)
          Append a TextRun object
 TextStyle getDefaultStyle()
          Get the default TextStyle
 void paint(java.awt.Graphics g)
          just called renderViewable(g)
 java.awt.Dimension preferredSize()
          The preferredSize we return is the size we would have to be to fully render our contents given our current width.
 void reshape(int x, int y, int w, int h)
          Overridden.
 void setFont(java.awt.Font f)
          Start using a new font (by font object)
 void setFont(java.lang.String name)
          Start using a new font (by name)
 void setFontSize(int size)
          Start using a new font size
 void setYTranslation(int y)
          The the Y translation, or offset value
 void show()
          Overridden so that we force a scroll to the very bottom, if auto-scrolling is enabled
 void update(java.awt.Graphics g)
          overridden to just call paint(g)
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FONT

public static java.awt.Font DEFAULT_FONT

_runs

protected java.util.Vector _runs

_defaultStyle

protected TextStyle _defaultStyle

_yTranslation

protected int _yTranslation

_firstRun

protected int _firstRun
Constructor Detail

TextView

public TextView(boolean autoScrolling)
Construct a new scrollview
Parameters:
autoScrolling - indicates whether this TextView should automatically scroll to the bottom when new text is added

TextView

public TextView()
Construct a new scrollview that does not auto-scroll
Method Detail

getDefaultStyle

public TextStyle getDefaultStyle()
Get the default TextStyle

setFont

public void setFont(java.lang.String name)
Start using a new font (by name)

setFontSize

public void setFontSize(int size)
Start using a new font size

setFont

public void setFont(java.awt.Font f)
Start using a new font (by font object)
Overrides:
setFont in class java.awt.Component

append

public void append(java.lang.String s,
                   TextStyle style)
Append a string using the given TextStyle

append

public void append(TextRun run)
Append a TextRun object

append

public void append(java.lang.String s)
Append a string in the default style

setYTranslation

public void setYTranslation(int y)
The the Y translation, or offset value

update

public void update(java.awt.Graphics g)
overridden to just call paint(g)
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
just called renderViewable(g)
Overrides:
paint in class java.awt.Canvas

show

public void show()
Overridden so that we force a scroll to the very bottom, if auto-scrolling is enabled
Overrides:
show in class java.awt.Component

reshape

public void reshape(int x,
                    int y,
                    int w,
                    int h)
Overridden. In addition to calling super.reshape(), we re-render our contents if the width has changed.
Overrides:
reshape in class java.awt.Component

preferredSize

public java.awt.Dimension preferredSize()
The preferredSize we return is the size we would have to be to fully render our contents given our current width.
Overrides:
preferredSize in class java.awt.Component


Copyright © 2000-2002 Taso Lyristis