demo.webcab.chat.gui
Class ScrollArea

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--demo.webcab.chat.gui.ScrollArea
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.AdjustmentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ScrollArea
extends java.awt.Panel
implements java.awt.event.AdjustmentListener, java.io.Serializable

This bean adds the horizontal and vertical scrolling bars to the TextScroll JavaBean. It implements all of its public methods all over again, as a shortcut for programmers.

You may implement any of these two beans at your convenience.

Author:
WebCab Components
See Also:
TextScroll, Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
ScrollArea()
          The constructor for a scroll area object.
 
Method Summary
 void add(java.lang.String item)
           
 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 addFocusListener(java.awt.event.FocusListener l)
           
 void addItem(java.lang.String item)
          Same as addString.
 void addKeyListener(java.awt.event.KeyListener l)
           
 void addMouseListener(java.awt.event.MouseListener l)
           
 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 area.
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
           
 void changeImage(int image)
          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 number.
 void destroy()
          Destroys all the resources this bean posesses.
 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 of the 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 of the web 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.
 int getNoBackgrounds()
          Gets the number of total desktop images.
 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 color of the text.
 java.awt.Font getTextFont()
          Gets the current text font.
 TextScroll getTextScroll()
          Returns the local TextScroll object.
 int getValignMode()
           
 boolean getWordWrap()
          Returns true if the text is being word wrapped and false otherwise.
 void removeActionListener(java.awt.event.ActionListener l)
          This method unregisters an ActionListener object.
 void removeFocusListener(java.awt.event.FocusListener l)
           
 void removeKeyListener(java.awt.event.KeyListener l)
           
 void removeMouseListener(java.awt.event.MouseListener l)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void removeScrollAreaListener(ScrollAreaListener l)
          This method unregisters a previously registered ScrollArea listener object.
 void repaintBar()
           
 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 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 b)
          If set to false, the configuration dialog will not be accessible when right or middle mouse button clicking on the desktop.
 void setConfigurationFile(java.lang.String url)
          This method invokes the method with the same name from the TextScroll class.
 void setDisplayFlag(int displayFlag)
          Sets a flag for displaying the desktop image.
 void setFinalString(java.lang.String string, java.lang.String headerString)
          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 noLines)
          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 selectFlag)
          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)
          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 f)
          Selects a new font for the text.
 void setValignMode(int mode)
           
 void setWordWrap(boolean b)
          Enable word wrapping, so all text be seen on the screen.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScrollArea

public ScrollArea()
           throws java.io.IOException,
                  java.lang.ClassNotFoundException
The constructor for a scroll area object. It is recommended that you use the setConfigurationFile method in order to define the properties for this bean.
See Also:
setConfigurationFile(java.lang.String)
Method Detail

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

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:
TextScroll.getMinimumSize()

setWordWrap

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

getWordWrap

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

setTextFont

public void setTextFont(java.awt.Font f)
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)

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()

setSelectFlag

public void setSelectFlag(int selectFlag)
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.
See Also:
getSelectFlag(), TextScroll.SELECT_NONE, TextScroll.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), TextScroll.SELECT_NONE, TextScroll.SELECT_ALLOW

setConfigurable

public void setConfigurable(boolean b)
If set to false, the configuration dialog will not be accessible when right or middle mouse button 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)

setConfigurationFile

public void setConfigurationFile(java.lang.String url)
This method invokes the method with the same name from the TextScroll class. Please check out the See Also link to read the complete description.
See Also:
TextScroll.setConfigurationFile(java.lang.String), getConfigurationFile()

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:
TextScroll.setConfigurationFile(java.lang.String)

addString

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

setFinalString

public void setFinalString(java.lang.String string,
                           java.lang.String headerString)
Documentation for this method is not public.

setString

public void setString(java.lang.String string,
                      java.lang.String headerString)
Documentation for this method is not public.

setMaxNoLines

public void setMaxNoLines(int noLines)
Defines the maximum limit of the number of lines this component may display. The lines over this limit remove the oldest one and scroll all up.
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)

getTextScroll

public TextScroll getTextScroll()
Returns the local TextScroll object. This way, the developer can call TextScroll specific methods, being able for example to add specific listeners to the actual bean.

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()

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()

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 color of the text.
Returns:
The text color.
See Also:
getColorTable()

getHighlightColor

public java.awt.Color getHighlightColor()
Gets the color of the highlighted text.
Returns:
The highlighted text color.
See Also:
getColorTable()

getLinkColor

public java.awt.Color getLinkColor()
Gets the color of the web links.
Returns:
The web links color.
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[])

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)

changeImage

public void changeImage(int image)
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)

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)

setDisplayFlag

public void setDisplayFlag(int displayFlag)
Sets a flag for displaying the desktop image. See the TextScroll corresponding method.
See Also:
TextScroll.setDisplayFlag(int)

getDisplayFlag

public int getDisplayFlag()
Gets the flag for displaying the desktop image. See the TextScroll corresponding method.
See Also:
TextScroll.getDisplayFlag()

setStretchMode

public void setStretchMode(int stretchMode)
This method sets the rendering method for the desktop image.
See Also:
TextScroll.setStretchMode(int)

getStretchMode

public int getStretchMode()
Gets the rendering method for the desktop image.
See Also:
TextScroll.getStretchMode()

getNoBackgrounds

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

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()

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(demo.webcab.chat.gui.ScrollAreaListener)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
This method unregisters an ActionListener object.
See Also:
removeScrollAreaListener(demo.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)

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)
Overrides:
addMouseListener in class java.awt.Component

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener l)
Overrides:
removeMouseListener in class java.awt.Component

addFocusListener

public void addFocusListener(java.awt.event.FocusListener l)
Overrides:
addFocusListener in class java.awt.Component

addKeyListener

public void addKeyListener(java.awt.event.KeyListener l)
Overrides:
addKeyListener in class java.awt.Component

removeFocusListener

public void removeFocusListener(java.awt.event.FocusListener l)
Overrides:
removeFocusListener in class java.awt.Component

removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener l)
Overrides:
removeKeyListener in class java.awt.Component

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)

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()

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()

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()

delItem

public void delItem(int index)
Deletes the indexth line number. Note: If you wish to delete all lines, better use delAll for speed.
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)

getItemCount

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

add

public void add(java.lang.String item)

addItem

public void addItem(java.lang.String item)
Same as addString.
See Also:
addString(java.lang.String)

setItemAt

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

destroy

public void destroy()
Destroys all the resources this bean posesses.

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

setValignMode

public void setValignMode(int mode)

getValignMode

public int getValignMode()

repaintBar

public void repaintBar()