[.home.]
[.hacks.]
[.java.]

Class Caption

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--Awt
                          |
                          +--Caption
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.AdjustmentListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.event.KeyListener, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
Direct Known Subclasses:
BorderPanel, Knob

public class Caption
extends Awt

(#)Caption.java

Version:
3.2 19-Mar-2004

A caption (label) that can display Awt hypertext
Author:
Holger Pfaff
See Also:
Serialized Form

Field Summary
protected  boolean active
          component states (used for implementing classes)
protected  java.awt.Rectangle activeRect
          list of hrefs in this caption. maps rectangle to string
protected  java.lang.String caption
          our contents
protected  boolean entered
           
protected  java.util.Hashtable hrefs
          list of hrefs in this caption. maps rectangle to string
protected  int iconDist
          icon layout if any
protected  int iconPos
           
protected  boolean invalid
          is layout invalid ?
protected  int mode
          Modes
 
Fields inherited from class Awt
actionListener, Background, bg, big, bim, Black, BlueMask, Bold, Bolditalic, borderDepth, borderType, BOTTOM, Brighter, Bulk, BULK, C, Center, CENTER, ColorMask, componentStates, Darker, E, East, EFFECT_MASK, Esc, FILL, Flat, FontMask, fonts, FontSize0, FontSizeMask, Foreground, GreenMask, Href, HREF, Hrefend, innerInsets, insets, Italic, itemListener, jvendor, jversion, Larger, LEFT, minimumDimension, MISC_MASK, Monospaced, N, NE, None, NONE, North, NorthEast, NorthWest, Null, NW, Plain, POSITION_MASK, Raised, RAISED, RedMask, RIGHT, S, SansSerif, SE, Serif, Smaller, South, SouthEast, SouthWest, Sunken, SUNKEN, SW, Tab0, TabMask, TabSizeMask, TOP, Uline, ULINE, W, West, White
 
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
Caption()
          Constructor for an empty caption
Caption(java.lang.String caption)
          Standard constructor
Caption(java.lang.String caption, int mode)
          Constructor with additional alignment specification
 
Method Summary
 void doHref(java.lang.String s, int x, int y, int w, int h)
          Overwrite Awt.doHref()
 java.lang.String getCaption()
          get current caption
 java.lang.String getHref()
          get current Hyper reference if any
 java.lang.String getLabel()
          get current caption (compat with java.awt.Label)
 int getMode()
          get current mode
 java.lang.String getText()
          get current caption (compat with java.awt.TextComponent)
 java.lang.String getTitle()
          get current caption (compat with java.awt.Label)
 void invalidate()
          Overwrite Awt.invalidate()
 boolean isActive()
          get current state
 boolean isEntered()
          get current state
 java.awt.Dimension measure()
          calculate required sizes
 java.awt.Dimension measureCaption()
          calculate Caption (Title) size including a fix one pixel border left/right two pixel top/bottom
 java.awt.Dimension measureIcon()
          calculate Icon size - intended as a placeholder for implementing classes
 void mouseExited(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mouseMoved(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mousePressed(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void paint(java.awt.Graphics g)
          Overwirte paint to do the actual artwork ;-)
 void paintCaption(java.awt.Graphics g, int x, int y, int w, int h)
          Paint the Caption (Title)
 void paintIcon(java.awt.Graphics g, int x, int y, int w, int h)
          Paint the Icon
 void setActive(boolean a)
          set current activity state
 void setCaption(java.lang.String c)
          set a new caption
 void setEntered(boolean e)
          set current entered state
 void setLabel(java.lang.String l)
          set a new caption (compat with java.awt.Label)
 void setMode(int m)
          set the mode
 void setText(java.lang.String t)
          set a new caption (compat with java.awt.TextComponent)
 void setTitle(java.lang.String l)
          set a new caption (compat with java.awt.Label)
 
Methods inherited from class Awt
addActionListener, addItemListener, addNotify, adjustmentValueChanged, Array2Insets, bold, bolditalic, brighter, centerWindow, Color2Esc, darker, dim, doMeasure, drawCaption, drawCaption, drawLine, drawRectangle, drawString, drawString, drawTriangle, error, exHref, exString, focusGained, focusLost, getAppletContext, getBG, getBGImage, getBGParent, getBGParentImage, getBorderDepth, getBorderRectangle, getBorderType, getColor, getColor, getFont, getFont, getFont, getInnerInsets, getInnerRectangle, getInsets, getMetrics, getMinimumSize, getMode, getPosition, getPreferredSize, getRectangle, getSelectedObjects, getTab, getTopComponent, isBulk, isEffect, isFill, isHref, isMSJVM, isNS4JVM, isRaised, isSunken, isUline, italic, keyPressed, keyReleased, keyTyped, larger, loadImage, loadImageFromArchive, loadImageFromStream, loadImageFromURL, makeBim, measureCaption, measureString, monospaced, mouseClicked, mouseDragged, mouseEntered, mouseReleased, notifyActionListeners, notifyItemListeners, paintBackground, paintBackground, paintBim, paintBorder, plain, refresh, refresh, refreshAll, removeActionListener, removeItemListener, sansserif, serif, setBackground, setBG, setBGIfNull, setBorderDepth, setBorderType, setBorderType, setBounds, setEnabled, setFont, setFont, setForeground, setInnerInsets, setInsets, setVisible, smaller, tile, tile, update, waitForImage
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

caption

protected java.lang.String caption
our contents


iconDist

protected int iconDist
icon layout if any


iconPos

protected int iconPos

active

protected boolean active
component states (used for implementing classes)


entered

protected boolean entered

mode

protected int mode
Modes


invalid

protected boolean invalid
is layout invalid ? (needed for recalc of href pos)


hrefs

protected java.util.Hashtable hrefs
list of hrefs in this caption. maps rectangle to string


activeRect

protected java.awt.Rectangle activeRect
list of hrefs in this caption. maps rectangle to string

Constructor Detail

Caption

public Caption()
Constructor for an empty caption


Caption

public Caption(java.lang.String caption)
Standard constructor

Parameters:
caption - the text

Caption

public Caption(java.lang.String caption,
               int mode)
Constructor with additional alignment specification

Parameters:
caption - the text
mode - the line mode
Method Detail

setCaption

public void setCaption(java.lang.String c)
set a new caption


getCaption

public java.lang.String getCaption()
get current caption


setLabel

public void setLabel(java.lang.String l)
set a new caption (compat with java.awt.Label)


getLabel

public java.lang.String getLabel()
get current caption (compat with java.awt.Label)


setTitle

public void setTitle(java.lang.String l)
set a new caption (compat with java.awt.Label)


getTitle

public java.lang.String getTitle()
get current caption (compat with java.awt.Label)


setText

public void setText(java.lang.String t)
set a new caption (compat with java.awt.TextComponent)

Parameters:
t - the text

getText

public java.lang.String getText()
get current caption (compat with java.awt.TextComponent)


setMode

public void setMode(int m)
set the mode

Parameters:
m - the mode

getMode

public int getMode()
get current mode


setActive

public void setActive(boolean a)
set current activity state

Parameters:
a - the state

isActive

public boolean isActive()
get current state


setEntered

public void setEntered(boolean e)
set current entered state

Parameters:
e - the state

isEntered

public boolean isEntered()
get current state


paint

public void paint(java.awt.Graphics g)
Overwirte paint to do the actual artwork ;-)

Overrides:
paint in class Awt
Parameters:
g - Graphics object to use

paintCaption

public void paintCaption(java.awt.Graphics g,
                         int x,
                         int y,
                         int w,
                         int h)
Paint the Caption (Title)

Parameters:
g - Graphics object to use
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect

paintIcon

public void paintIcon(java.awt.Graphics g,
                      int x,
                      int y,
                      int w,
                      int h)
Paint the Icon

Parameters:
g - Graphics object to use
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect

measureCaption

public java.awt.Dimension measureCaption()
calculate Caption (Title) size including a fix one pixel border left/right two pixel top/bottom


measureIcon

public java.awt.Dimension measureIcon()
calculate Icon size - intended as a placeholder for implementing classes


measure

public java.awt.Dimension measure()
calculate required sizes

Overrides:
measure in class Awt

invalidate

public void invalidate()
Overwrite Awt.invalidate()

Overrides:
invalidate in class Awt

doHref

public void doHref(java.lang.String s,
                   int x,
                   int y,
                   int w,
                   int h)
Overwrite Awt.doHref()

Overrides:
doHref in class Awt
Parameters:
s - the href string (including href & text)
x - x pos of describing rect
y - y pos of describing rect
w - width of describing rect
h - height of describing rect

getHref

public java.lang.String getHref()
get current Hyper reference if any


mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class Awt

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseExited in interface java.awt.event.MouseListener
Overrides:
mouseExited in class Awt

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class Awt

[.home.]
[.hacks.]
[.java.]