com.webcab.chat.gui
Class TextScroll

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.webcab.chat.gui.TextScroll
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class TextScroll
extends java.awt.Canvas
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

This bean represents a multi-line region which can displays text and pictures, customize desktop images, allow word-wrap control, smooth scrolling. It also allows the user to change font sizes, colors and styles, play sounds and choose image render quality. TextScroll is somewhat similar to the basic java.awt.TextArea class, which draws text on more than just one line. Albeit, this bean extends the Canvas class and provides much more possibilities in displaying image and text.

The bean has many features, some of them kindly offered by the BeanInfo class as a convenience for designers. Here are some:

This bean is used by ScrollArea, which adds the scrolling bars. You may implement any of these, according to your requirements. The optimal way to use them is by providing a configuration file wherein all the settings are defined.

See Also:
ScrollArea, setConfigurationFile(java.lang.String), ColorPicker, ImageCache, 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
static java.lang.String AREA
          This constant is the string definition for an area-like behaviour of the componen, being used inside the configuration file.
static java.lang.String CENTER
          The constant which specifies the string correspondent of the IMAGE_CENTER integer constant.
static short DEFAULT_MAX_FONT_SIZE
          This is the absolute maximum font size that a user or developer may access.
static int DEFAULT_MAX_NO_LINES
          The default maximum size of lines the scroll area can hold.
static short DEFAULT_MIN_FONT_SIZE
          This is the absolute minimum font size that a user or developer may access.
static java.lang.String FAST
          The constant which specifies the string correspondent of the java.awt.Image.SCALE_FAST integer constant.
static int IMAGE_CENTER
          This constant is sent as an argument to setDisplayFlag in order to specify that the background image will be centered.
static java.lang.String IMAGE_SIGN
           
static int IMAGE_STRETCH
          This constant is sent as an argument to setDisplayFlag in order to specify that the background imagez will be stretched to fit the desktop.
static int IMAGE_TILE
          This constant is sent as an argument to setDisplayFlag in order to specify that the background image will be tiled.
 java.lang.String[] imageDefinitions
           
static java.lang.String LIST
          This constant is the string definition for an list-like behaviour of the component, being used inside the configuration file.
static int SELECT_ALLOW
          This constant tells the setSelectFlag method that this bean behave like a list, by allowing mouse selection.
static int SELECT_NONE
          This constant tells the setSelectFlag method that this bean behave like a text area.
static java.lang.String SIZE_SIGN
           
static java.lang.String SMOOTH
          The constant which specifies the string correspondent of the java.awt.Image.SCALE_SMOOTH integer constant.
static java.lang.String STRETCH
          The constant which specifies the string correspondent of the IMAGE_STRETCH integer constant.
static int TEXT_OVER
          Not implemented yet.
static int TEXT_WITH
          Not implemented yet.
static java.lang.String TILE
          The constant which specifies the string correspondent of the IMAGE_TILE integer constant.
static int VALIGN_AREA
          The vertical alignment is specified as to scroll upwards, like a scrolling area.
static int VALIGN_LIST
          The vertical alignment is specified as to scroll downwards, like a standard list.
 
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
TextScroll()
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          By adding an ActionListener to an instance of this bean, an actionPerformed (ActionEvent) method will be invoked every time the user double-clicks inside the working area.
 void addNotify()
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void addScrollAreaListener(ScrollAreaListener l)
          This method registers a ScrollArea specific listener object.
 void addString(java.lang.String string)
          Adds a new line to the text.
 void addString(java.lang.String string, int mode)
          Add a new line and marks with the mode flag.
 void changeImage(int backgroundNumber)
          Changes the background image to the indexth one.
 void changeImage(int backgroundNumber, int displayFlag, int stretchMode)
          Changes the background image to the indexth one, in the specified display mode and stretch type.
 void delAll()
          Clears the list of all of its elements.
 void delItem(int index)
          Deletes the indexth line numbe.
 void destroy()
          Disposes all resources this bean might use.
 void disposeConfigurationDialog(ConfigurationDialog givenDialog)
          This method is called only by the configuration dialog object created by TextScroll itself.
 java.applet.Applet getApplet()
          If you have specified an applet in setApplet, this method will return its pointer.
 java.awt.Color getBackgroundColor()
          Gets the color of the background.
 java.awt.Image getBackgroundImage()
          Gets the image as it appears on the background.
 java.awt.Image getBackgroundImageAt(int index)
          Gets one of the images that are in the desktop images list.
 int getBackgroundNumber()
          Gets the index number of the desktop image.
 java.awt.Color[] getColorTable()
          Gets the background, text, highlighted text and links color in a java.awt.Color array.
 boolean getConfigurable()
          If this method returns true then right or middle mouse button cliking on the desktop will pop a configuration dialog up.
 java.lang.String getConfigurationFile()
          Gets the name of the configuration file.
 int getDisplayFlag()
          Gets the flag for displaying the desktop image.
 java.awt.Color getHighlightColor()
          Gets the color that the user wishes to use for highlighted text.
 java.lang.String getItem(int index)
          Gets the line at the specified index.
 int getItemCount()
          Gets the number of lines this bean has.
 java.awt.Color getLinkColor()
          Gets the color that the user wishes to use for Internet links.
 int getMaxFontSize()
          Returns the value of the maximum font size that the user can choose inside the configuration dialog.
 int getMaxNoLines()
          Gets the maximum limit of the number of lines this component may display.
 int getMinFontSize()
          Returns the value of the minimum font size that the user can choose inside the configuration dialog.
 java.awt.Dimension getMinimumSize()
          This is the overriden method from java.awt.Component which returns whatever is specified by setMinimumSize.
 int getNoBackgrounds()
          Gets the number of total desktop images.
 java.awt.Dimension getPreferredSize()
          Returns the minimum size returned by getMinimumSize.
 int getSelectedIndex()
          If the bean is in the list mode, then this method returns the index of the selected line.
 java.lang.String getSelectedItem()
          If the bean is in the list mode, then this method returns the selected line.
 int getSelectFlag()
          Returns SELECT_NONE if the bean acts like a text area or SELECT_ALLOW if the bean acts like a list.
 int getStretchMode()
          Gets the rendering method for the desktop image.
 java.awt.Color getTextColor()
          Gets the default color of the text, as selected by the user.
 java.awt.Font getTextFont()
          Gets the current text font.
 int getValignMode()
          Informs on the type of alignment this area provides.
 boolean getWordWrap()
          Returns true if the text is being word wrapped or false otherwise.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics g)
           
 void removeActionListener(java.awt.event.ActionListener l)
          This method unregisters an ActionListener object.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void removeScrollAreaListener(ScrollAreaListener l)
          This method unregisters a previously registered ScrollArea listener object.
 void setApplet(java.applet.Applet applet)
          If you wish to use this bean inside an applet, register it through this method.
 void setBackgroundColor(java.awt.Color color)
          Sets the background color of the rendering surface.
 void setBounds(int x, int y, int w, int h)
           
 void setColorTable(java.awt.Color[] colorTable)
          Sets all the colors - background, text, highlighted text and links - to the ones specified in the java.awt.Color array.
 void setConfigurable(boolean configurable)
          If set to false, the configuration dialog will not be accessible when right clicking on the desktop.
 void setConfigurationFile(java.lang.String url)
          This method specifies the URL location of the configuration file, where all the startup settings are being specified.
 void setDisplayFlag(int displayFlag)
          Sets a flag for displaying the desktop image.
 void setFinalString(java.lang.String string, java.lang.String headerString)
          The documentation for this method is not public.
 void setHighlightColor(java.awt.Color color)
          Sets the color of the highlighted text.
 void setItemAt(java.lang.String item, int index)
          Changes the value of the indexth line number to item.
 void setLinkColor(java.awt.Color color)
          Sets the color of the Internet links.
 void setMaxFontSize(int maxFontSize)
          Sets the maximum font size that the user can configure from the Configuration Dialog.
 void setMaxNoLines(int maxNoLines)
          Defines the maximum limit of the number of lines this component may display.
 void setMinFontSize(int minFontSize)
          Sets the minimum font size that the user can configure from the Configuration Dialog.
 void setMinimumSize(java.awt.Dimension size)
          Defines the minimum layout size of this component.
 void setSelectedIndex(int selectedIndex)
          Changes the selection bar to the specified line number.
 void setSelectFlag(int value)
          Determines whether this bean should act like a normal text area or like a list.
 void setStretchMode(int stretchMode)
          This method sets the rendering method for the desktop image.
 void setString(java.lang.String string, java.lang.String headerString)
          The documentation for this method is not public.
 void setTextColor(java.awt.Color color)
          Sets the default color of the rendered text.
 void setTextFont(java.awt.Font font)
          Selects a new font for the text.
 void setValignMode(int mode)
          This method specifies the way new elements added to the area should be laid out.
 void setWordWrap(boolean wordWrap)
          Enable word wrapping, so all text be seen on the screen.
 void update(java.awt.Graphics g)
           
 
Methods inherited from class java.awt.Canvas
getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, 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, getName, getParent, getPeer, 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, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, 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_MAX_NO_LINES

public static final int DEFAULT_MAX_NO_LINES
The default maximum size of lines the scroll area can hold. It's value is 100 lines.
See Also:
setMaxNoLines(int), getMaxNoLines()

SELECT_NONE

public static final int SELECT_NONE
This constant tells the setSelectFlag method that this bean behave like a text area.
See Also:
setSelectFlag(int), getSelectFlag()

SELECT_ALLOW

public static final int SELECT_ALLOW
This constant tells the setSelectFlag method that this bean behave like a list, by allowing mouse selection.
See Also:
setSelectFlag(int), getSelectFlag()

VALIGN_AREA

public static final int VALIGN_AREA
The vertical alignment is specified as to scroll upwards, like a scrolling area. This value is sent as a parameter to setValignMode.
See Also:
setValignMode(int), getValignMode()

VALIGN_LIST

public static final int VALIGN_LIST
The vertical alignment is specified as to scroll downwards, like a standard list. This means that when adding more elements to the list, they will be added starting from the topmost slot and continuing down the list, without scrolling after the last one even if it does not fit the list area. This value allows the area to act like a list when adding elements. This value is sent as a parameter to setValignMode.
See Also:
setValignMode(int), getValignMode()

IMAGE_CENTER

public static final int IMAGE_CENTER
This constant is sent as an argument to setDisplayFlag in order to specify that the background image will be centered.
See Also:
setDisplayFlag(int), getDisplayFlag()

IMAGE_TILE

public static final int IMAGE_TILE
This constant is sent as an argument to setDisplayFlag in order to specify that the background image will be tiled.
See Also:
setDisplayFlag(int), getDisplayFlag()

IMAGE_STRETCH

public static final int IMAGE_STRETCH
This constant is sent as an argument to setDisplayFlag in order to specify that the background imagez will be stretched to fit the desktop.
See Also:
setDisplayFlag(int), getDisplayFlag()

LIST

public static final java.lang.String LIST
This constant is the string definition for an list-like behaviour of the component, being used inside the configuration file. It's value is "List".
See Also:
setValignMode(int)

AREA

public static final java.lang.String AREA
This constant is the string definition for an area-like behaviour of the componen, being used inside the configuration file. It's value is "Area".
See Also:
setValignMode(int)

CENTER

public static final java.lang.String CENTER
The constant which specifies the string correspondent of the IMAGE_CENTER integer constant. It is used in the configuration file in order to recognize settings for DISPLAY_FLAG value. See setConfigurationFile for a full description. The value of this constant is "Center".
See Also:
setConfigurationFile(java.lang.String)

TILE

public static final java.lang.String TILE
The constant which specifies the string correspondent of the IMAGE_TILE integer constant. It is used in the configuration file in order to recognize settings for DISPLAY_FLAG value. See setConfigurationFile for a full description. The value of this constant is "Tile".
See Also:
setConfigurationFile(java.lang.String)

STRETCH

public static final java.lang.String STRETCH
The constant which specifies the string correspondent of the IMAGE_STRETCH integer constant. It is used in the configuration file in order to recognize settings for DISPLAY_FLAG value. See setConfigurationFile for a full description. The value of this constant is "Stretch".
See Also:
setConfigurationFile(java.lang.String)

SMOOTH

public static final java.lang.String SMOOTH
The constant which specifies the string correspondent of the java.awt.Image.SCALE_SMOOTH integer constant. It is used in the configuration file in order to recognize settings for STRETCH_MODE value. See setConfigurationFile for a full description. The value of this constant is "Smooth".
See Also:
setConfigurationFile(java.lang.String)

FAST

public static final java.lang.String FAST
The constant which specifies the string correspondent of the java.awt.Image.SCALE_FAST integer constant. It is used in the configuration file in order to recognize settings for STRETCH_MODE value. See setConfigurationFile for a full description. The value of this constant is "Fast".
See Also:
setConfigurationFile(java.lang.String)

TEXT_OVER

public static final int TEXT_OVER
Not implemented yet.

TEXT_WITH

public static final int TEXT_WITH
Not implemented yet.

DEFAULT_MIN_FONT_SIZE

public static final short DEFAULT_MIN_FONT_SIZE
This is the absolute minimum font size that a user or developer may access. It's value is 4pt.

DEFAULT_MAX_FONT_SIZE

public static final short DEFAULT_MAX_FONT_SIZE
This is the absolute maximum font size that a user or developer may access. It's value is 250pt.

SIZE_SIGN

public static final java.lang.String SIZE_SIGN

IMAGE_SIGN

public static final java.lang.String IMAGE_SIGN

imageDefinitions

public java.lang.String[] imageDefinitions
Constructor Detail

TextScroll

public TextScroll()
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
By adding an ActionListener to an instance of this bean, an actionPerformed (ActionEvent) method will be invoked every time the user double-clicks inside the working area.
See Also:
addScrollAreaListener(com.webcab.chat.gui.ScrollAreaListener)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
This method unregisters an ActionListener object.
See Also:
removeScrollAreaListener(com.webcab.chat.gui.ScrollAreaListener)

addScrollAreaListener

public void addScrollAreaListener(ScrollAreaListener l)
This method registers a ScrollArea specific listener object.
See Also:
ScrollAreaListener, addActionListener(java.awt.event.ActionListener)

removeScrollAreaListener

public void removeScrollAreaListener(ScrollAreaListener l)
This method unregisters a previously registered ScrollArea listener object.
See Also:
removeActionListener(java.awt.event.ActionListener)

setMinimumSize

public void setMinimumSize(java.awt.Dimension size)
Defines the minimum layout size of this component.
Parameters:
size - The dimension of the minimum size
See Also:
getMinimumSize()

getMinimumSize

public java.awt.Dimension getMinimumSize()
This is the overriden method from java.awt.Component which returns whatever is specified by setMinimumSize. There is though a default reasonable value for the minimum size.
Overrides:
getMinimumSize in class java.awt.Component
See Also:
setMinimumSize(java.awt.Dimension)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the minimum size returned by getMinimumSize.
Overrides:
getPreferredSize in class java.awt.Component
See Also:
getMinimumSize()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Overrides:
addPropertyChangeListener in class java.awt.Component

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Overrides:
removePropertyChangeListener in class java.awt.Component

setApplet

public void setApplet(java.applet.Applet applet)
If you wish to use this bean inside an applet, register it through this method. Then, mouse hovering over links will display in the browser's status bar and mouse clicks will open new browser windows. The applet is also needed to play sounds.
Parameters:
applet - The applet where this component is going to be added.
See Also:
getApplet()

getApplet

public java.applet.Applet getApplet()
If you have specified an applet in setApplet, this method will return its pointer.
Returns:
The applet where this component has been added.
See Also:
setApplet(java.applet.Applet)

setConfigurationFile

public void setConfigurationFile(java.lang.String url)
This method specifies the URL location of the configuration file, where all the startup settings are being specified. The file is structured into NAME = VALUE lines. The VALUE may be an integer, a text, a boolean or a font description. Here are the tags you may use inside a configuration file. Here is a test configuration file:

Configuration File for ScrollArea
 
 NEW_BACKGROUND = "http://webcab.co.uk/chat/library/back1.jpg"
 NEW_BACKGROUND = "library/back2.jpg" - This file is loaded relative to the applet's code base
 NEW_BACKGROUND = "http://webcab.co.uk/chat/library/open.jpg"
 NEW_BACKGROUND = "http://webcab.co.uk/beans/gifs/cigar_med_wte.gif"
 NEW_BACKGROUND = "http://webcab.co.uk/chat/library/back5.jpg"
 NEW_BACKGROUND = "http://webcab.co.uk/chat/library/back6.jpg"
 
 STARTUP_IMAGE	= 5
 
 WORD_WRAP = TRUE
 
 DISPLAY_FLAG = TILE
 STRETCH_MODE = FAST
 
 SELECT_FLAG = SELECT_ALLOW
 
 FONT = "SansSerif", PLAIN, 14
 
 backgroundColor = 150, 150, 250
 textColor = 0, 0, 120
 highlightColor = 255, 0, 255
 linkColor = 0, 120, 255
 
 NEW_PICTURE	= "http://webcab.co.uk/beans/gifs/cigar_med_wte.gif"
 NEW_PICTURE	= "http://webcab.co.uk/beans/gifs/cmtcigars_logo.jpg"
 NEW_PICTURE	= "http://webcab.co.uk/beans/gifs/animcigar.gif"
 NEW_PICTURE	= "http://webcab.co.uk/chat/library/pictures/happy1.gif"
 NEW_PICTURE	= "http://webcab.co.uk/chat/library/pictures/happy2.gif"
 NEW_PICTURE	= "http://webcab.co.uk/chat/library/pictures/happy3.gif"
 
 
See Also:
getConfigurationFile(), ConfigurationDialog

getConfigurationFile

public java.lang.String getConfigurationFile()
Gets the name of the configuration file.
Returns:
The URL location of the configuration file, as a String
See Also:
setConfigurationFile(java.lang.String)

setConfigurable

public void setConfigurable(boolean configurable)
If set to false, the configuration dialog will not be accessible when right clicking on the desktop.
Parameters:
configurable - The true/false boolean.
See Also:
getConfigurable()

getConfigurable

public boolean getConfigurable()
If this method returns true then right or middle mouse button cliking on the desktop will pop a configuration dialog up.
Returns:
The state of the configurable flag.
See Also:
setConfigurable(boolean)

setValignMode

public void setValignMode(int mode)
This method specifies the way new elements added to the area should be laid out. If you wish them to be displayed as inside a standard WebCab ScrollArea v2.0, then the mode parameter should be given the VALIGN_AREA value. In this case, any new line added will display at the bottom of the rendering surface, and all the previous lines will be scrolled up to fit it in.

In case you wish the area act in a List-like mode, use the VALIGN_LIST value, allowing the first elements to be added from top to bottom.

Any other values will be ignored.

See Also:
getValignMode()

getValignMode

public int getValignMode()
Informs on the type of alignment this area provides.
Returns:
Area-like or list-like vertical alignment mode.
See Also:
setValignMode(int)

setSelectFlag

public void setSelectFlag(int value)
Determines whether this bean should act like a normal text area or like a list.
Parameters:
value - If this is equal to SELECT_NONE, the bean acts like a text area, if it equals to SELECT_ALLOW, the bean acts like a list. The latter allows you to select each separate line individually
See Also:
getSelectFlag(), SELECT_NONE, SELECT_ALLOW

getSelectFlag

public int getSelectFlag()
Returns SELECT_NONE if the bean acts like a text area or SELECT_ALLOW if the bean acts like a list.
Returns:
One of the two possible states
See Also:
setSelectFlag(int), SELECT_NONE, SELECT_ALLOW

getWordWrap

public boolean getWordWrap()
Returns true if the text is being word wrapped or false otherwise.
Returns:
True of false.
See Also:
setWordWrap(boolean)

setWordWrap

public void setWordWrap(boolean wordWrap)
Enable word wrapping, so all text be seen on the screen.
Parameters:
wordwrap - True to enable wordwraping, false to disable it.
See Also:
getWordWrap()

getSelectedIndex

public int getSelectedIndex()
If the bean is in the list mode, then this method returns the index of the selected line.
Returns:
The index of the selected line.
See Also:
getSelectedItem(), setSelectedIndex(int)

getSelectedItem

public java.lang.String getSelectedItem()
If the bean is in the list mode, then this method returns the selected line.
Returns:
The selected line.
See Also:
getSelectedIndex()

getItemCount

public int getItemCount()
Gets the number of lines this bean has.
Returns:
The number of items (ie. lines)

getItem

public java.lang.String getItem(int index)
Gets the line at the specified index.
Returns:
The value of the string at the index line.
See Also:
getSelectedItem()

setItemAt

public void setItemAt(java.lang.String item,
                      int index)
Changes the value of the indexth line number to item. Could result in an ArrayIndexOutOfBoundsException.
Parameters:
item - The new string value
index - The line number

delItem

public void delItem(int index)
Deletes the indexth line numbe.
Parameters:
index - The line to be deleted
See Also:
delAll()

delAll

public void delAll()
Clears the list of all of its elements. A faster alternative to delItem.
See Also:
delItem(int)

setSelectedIndex

public void setSelectedIndex(int selectedIndex)
Changes the selection bar to the specified line number.
Parameters:
selectedIndex - The index to change to. If -1, no line is selected
See Also:
getSelectedIndex()

getBackgroundNumber

public int getBackgroundNumber()
Gets the index number of the desktop image. The numbering starts from 0.
Returns:
The index of the current background image.
See Also:
getBackgroundImage()

getBackgroundImage

public java.awt.Image getBackgroundImage()
Gets the image as it appears on the background. Null, if no image is there.
Returns:
The desktop image.
See Also:
getBackgroundNumber(), getBackgroundImageAt(int)

getBackgroundImageAt

public java.awt.Image getBackgroundImageAt(int index)
Gets one of the images that are in the desktop images list. The numbering starts from 0.
Parameters:
index - The index of the desktop image.
Returns:
The indexth background image, or null if out of range.
See Also:
getBackgroundImage()

getNoBackgrounds

public int getNoBackgrounds()
Gets the number of total desktop images.
Returns:
How many background images there are.
See Also:
getBackgroundNumber()

setMaxNoLines

public void setMaxNoLines(int maxNoLines)
Defines the maximum limit of the number of lines this component may display. The lines over this limit remove the first to let the new one in. The default is 100;
Parameters:
maxNoLines - The maximum number of lines.
See Also:
getMaxNoLines()

getMaxNoLines

public int getMaxNoLines()
Gets the maximum limit of the number of lines this component may display.
Returns:
The maximum number of lines.
See Also:
setMaxNoLines(int)

setDisplayFlag

public void setDisplayFlag(int displayFlag)
Sets a flag for displaying the desktop image. There are three flags you can choose of:
Parameters:
displayFlag - One of the above flags
See Also:
getDisplayFlag(), IMAGE_CENTER, IMAGE_TILE, IMAGE_STRETCH

getDisplayFlag

public int getDisplayFlag()
Gets the flag for displaying the desktop image. There are three flags you can obtain:
Returns:
One of the above flags
See Also:
setDisplayFlag(int), IMAGE_CENTER, IMAGE_TILE, IMAGE_STRETCH

setStretchMode

public void setStretchMode(int stretchMode)
This method sets the rendering method for the desktop image. This flag applies only if the display flag is set to IMAGE_STRETCH. You may choose one of the following:
Parameters:
stretchMode - One of the above constants
See Also:
getStretchMode()

getStretchMode

public int getStretchMode()
Gets the rendering method for the desktop image. This flag applies only if the display flag is set to IMAGE_STRETCH. You may get one of the following:
Returns:
If the image is scaled fast, then it returns 0, otherwise it returns 1.
See Also:
setStretchMode(int)

changeImage

public void changeImage(int backgroundNumber,
                        int displayFlag,
                        int stretchMode)
Changes the background image to the indexth one, in the specified display mode and stretch type.
Parameters:
backgroundNumber - The number of the new background image to be displayed.
displayFlag - The display flag as it is defined in setDisplayFlag
stretchMode - The stretch mode as it is defined in setStretchMode
See Also:
getNoBackgrounds(), setDisplayFlag(int), setStretchMode(int), changeImage(int)

changeImage

public void changeImage(int backgroundNumber)
Changes the background image to the indexth one.
Parameters:
backgroundNumber - The number of the new background image to be displayed.
See Also:
getNoBackgrounds(), changeImage(int, int, int)

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Overrides:
setBounds in class java.awt.Component

getBackgroundColor

public java.awt.Color getBackgroundColor()
Gets the color of the background.
Returns:
The background color.
See Also:
getColorTable()

getTextColor

public java.awt.Color getTextColor()
Gets the default color of the text, as selected by the user.
Returns:
The text color.
See Also:
getColorTable()

getHighlightColor

public java.awt.Color getHighlightColor()
Gets the color that the user wishes to use for highlighted text.
Returns:
The highlighted text color.
See Also:
getColorTable()

getLinkColor

public java.awt.Color getLinkColor()
Gets the color that the user wishes to use for Internet links.
Returns:
The web links color.
See Also:
getColorTable()

getColorTable

public java.awt.Color[] getColorTable()
Gets the background, text, highlighted text and links color in a java.awt.Color array.
Returns:
The array of colors.
See Also:
setColorTable(java.awt.Color[]), getBackgroundColor(), getTextColor(), getHighlightColor(), getLinkColor()

setColorTable

public void setColorTable(java.awt.Color[] colorTable)
Sets all the colors - background, text, highlighted text and links - to the ones specified in the java.awt.Color array.
Parameters:
colorTable - The array of colors
See Also:
getColorTable()

setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
Sets the background color of the rendering surface.
See Also:
setColorTable(java.awt.Color[])

setTextColor

public void setTextColor(java.awt.Color color)
Sets the default color of the rendered text.
See Also:
setColorTable(java.awt.Color[])

setHighlightColor

public void setHighlightColor(java.awt.Color color)
Sets the color of the highlighted text.
See Also:
setColorTable(java.awt.Color[])

setLinkColor

public void setLinkColor(java.awt.Color color)
Sets the color of the Internet links.
See Also:
setColorTable(java.awt.Color[])

getMinFontSize

public int getMinFontSize()
Returns the value of the minimum font size that the user can choose inside the configuration dialog.
See Also:
setMinFontSize(int)

getMaxFontSize

public int getMaxFontSize()
Returns the value of the maximum font size that the user can choose inside the configuration dialog.
See Also:
setMaxFontSize(int)

setMinFontSize

public void setMinFontSize(int minFontSize)
Sets the minimum font size that the user can configure from the Configuration Dialog. The change does not take place until the configuration dialog is re-opened.
See Also:
getMinFontSize()

setMaxFontSize

public void setMaxFontSize(int maxFontSize)
Sets the maximum font size that the user can configure from the Configuration Dialog. The change does not take place until the configuration dialog is re-opened.
See Also:
getMaxFontSize()

setTextFont

public void setTextFont(java.awt.Font font)
Selects a new font for the text.
Parameters:
font - The new text font
See Also:
getTextFont()

getTextFont

public java.awt.Font getTextFont()
Gets the current text font.
Returns:
The text font
See Also:
setTextFont(java.awt.Font)

addNotify

public void addNotify()
Overrides:
addNotify in class java.awt.Canvas

update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Component

paint

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

addString

public void addString(java.lang.String string)
Adds a new line to the text.
Parameters:
string - The String object to be added.

addString

public void addString(java.lang.String string,
                      int mode)
Add a new line and marks with the mode flag. No further documentation available yet.
See Also:
addString(java.lang.String)

setFinalString

public void setFinalString(java.lang.String string,
                           java.lang.String headerString)
The documentation for this method is not public.
See Also:
setString(java.lang.String, java.lang.String)

setString

public void setString(java.lang.String string,
                      java.lang.String headerString)
The documentation for this method is not public.
See Also:
setFinalString(java.lang.String, java.lang.String)

disposeConfigurationDialog

public void disposeConfigurationDialog(ConfigurationDialog givenDialog)
This method is called only by the configuration dialog object created by TextScroll itself. To be sure of this, the parameter must confirm the address where the local ConfigurationDialog points. The only way to call this method is disposeConfigurationDialog (this), from the body of the ConfigurationDialog created by this TextScroll instance.
Parameters:
givenDialog - The local ConfigurationDialog
See Also:
ConfigurationDialog

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

destroy

public void destroy()
Disposes all resources this bean might use.