org.jscience.architecture.traffic.util
Class Hyperlink

java.lang.Object
  extended by java.awt.Component
      extended by org.jscience.architecture.traffic.util.Hyperlink
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Hyperlink
extends java.awt.Component

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int alignment
          DOCUMENT ME!
static int CENTER
          Indicates that the label should be centered.
protected  java.lang.String label
          DOCUMENT ME!
static int LEFT
          Indicates that the label should be left justified.
protected  java.util.Vector listeners
          DOCUMENT ME!
static int RIGHT
          Indicates that the label should be right justified.
protected  java.awt.Rectangle textBounds
          DOCUMENT ME!
protected  boolean underline
          DOCUMENT ME!
 
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
Hyperlink()
          Constructs an empty hyperlink.
Hyperlink(java.lang.String text)
          Constructs a new hyperlink with the specified string of text, left justified.
Hyperlink(java.lang.String text, int al)
          Constructs a new hyperlink that presents the specified string of text with the specified alignment.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds the specified action listener to receive action events from this hyperlink.
 java.awt.event.ActionListener[] getActionListeners()
          Returns an array of the action listeners.
 int getAlignment()
          Returns the alignment of this hyperlink.
 java.lang.String getText()
          Returns the text of this hyperlink.
 boolean getUnderline()
          Checks if the text of this hyperlink is underlined.
 boolean isFocusTraversable()
          Returns true to allow hyperlinks to receive focus.
 void paint(java.awt.Graphics gr)
          Paints this hyperlink on the given Graphics object.
 void paintAll(java.awt.Graphics g)
          DOCUMENT ME!
 void removeActionListener(java.awt.event.ActionListener l)
          Removes the specified action listener so that it no longer receives action events from this hyperlink.
 void removeAllActionListeners()
          Removes all action listeners.
 void setAlignment(int al)
          Sets the alignment of this hyperlink to the specified alignment.
 void setText(java.lang.String text)
          Sets the text of this hyperlink to the specified text.
 void setUnderline(boolean ul)
          Underlines the text of this hyperlink if the specified value is true.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, 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, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, 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, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Indicates that the label should be left justified.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Indicates that the label should be centered.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Indicates that the label should be right justified.

See Also:
Constant Field Values

label

protected java.lang.String label
DOCUMENT ME!


underline

protected boolean underline
DOCUMENT ME!


alignment

protected int alignment
DOCUMENT ME!


listeners

protected java.util.Vector listeners
DOCUMENT ME!


textBounds

protected java.awt.Rectangle textBounds
DOCUMENT ME!

Constructor Detail

Hyperlink

public Hyperlink()
Constructs an empty hyperlink.


Hyperlink

public Hyperlink(java.lang.String text)
Constructs a new hyperlink with the specified string of text, left justified.

Parameters:
text - The lavel of the new hyperlink.

Hyperlink

public Hyperlink(java.lang.String text,
                 int al)
Constructs a new hyperlink that presents the specified string of text with the specified alignment.

Parameters:
text - The label of the new hyperlink.
al - The alignment of the label.
Method Detail

getText

public java.lang.String getText()
Returns the text of this hyperlink.

Returns:
DOCUMENT ME!

setText

public void setText(java.lang.String text)
Sets the text of this hyperlink to the specified text.

Parameters:
text - DOCUMENT ME!

getUnderline

public boolean getUnderline()
Checks if the text of this hyperlink is underlined.

Returns:
DOCUMENT ME!

setUnderline

public void setUnderline(boolean ul)
Underlines the text of this hyperlink if the specified value is true.

Parameters:
ul - DOCUMENT ME!

getAlignment

public int getAlignment()
Returns the alignment of this hyperlink.

Returns:
DOCUMENT ME!

setAlignment

public void setAlignment(int al)
Sets the alignment of this hyperlink to the specified alignment.

Parameters:
al - DOCUMENT ME!

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds the specified action listener to receive action events from this hyperlink. If l is null, no exception is thrown and no action is performed.

Parameters:
l - The action listener to add.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes the specified action listener so that it no longer receives action events from this hyperlink. Action events occur when a user releases the left mouse button when the mouse cursor is over this hyperlink. If l is null, no exception is thrown and no action is performed.

Parameters:
l - The action listener to remove.

removeAllActionListeners

public void removeAllActionListeners()
Removes all action listeners.


getActionListeners

public java.awt.event.ActionListener[] getActionListeners()
Returns an array of the action listeners.

Returns:
DOCUMENT ME!

isFocusTraversable

public boolean isFocusTraversable()
Returns true to allow hyperlinks to receive focus.

Overrides:
isFocusTraversable in class java.awt.Component
Returns:
DOCUMENT ME!

paint

public void paint(java.awt.Graphics gr)
Paints this hyperlink on the given Graphics object. It uses the current font and color of the Graphics object to draw the label and possible line under the label. You should use Component.setForeground() and Component.setFont() to change the font and/or color that is used to paint the label. See the AWT docs about the Component class for more information.

Overrides:
paint in class java.awt.Component
Parameters:
gr - The Graphics object to paint this hyperlink on.

paintAll

public void paintAll(java.awt.Graphics g)
DOCUMENT ME!

Overrides:
paintAll in class java.awt.Component
Parameters:
g - DOCUMENT ME!