com.sshtools.ui.awt
Class ImageTextLabel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycom.sshtools.ui.awt.ImageTextLabel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
AWTStatusLabel, ImageButton

public class ImageTextLabel
extends java.awt.Canvas

A label that can display both graphics and text, somewhat similar to swings JLabel.

Version:
$Revision: 1.1 $
Author:
$Author: richard $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int EMPTY
          Empty space (takes up 2 pixels)
static int LOWERED_BEVEL
          Lowered bevel border (takes up 2 pixels)
static int NONE
          No border.
static int RAISED_BEVEL
          Raised bevel border (takes up 2 pixels)
 
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
ImageTextLabel()
           
ImageTextLabel(java.awt.Image image, java.lang.String text)
           
 
Method Summary
 void addNotify()
           
 void doLayout()
           
 java.awt.Color getBorderColor()
           
 java.awt.Image getImage()
          Get the image
 java.awt.Insets getInsets()
          Return insets sufficient for bevel and label drawing space.
 java.awt.Insets getMargin()
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getText()
          Get the text to display
 int getTextImageGap()
          Get the gap (in pixels) between the image and text.
 boolean isTextVisible()
          Get whether or not the text is visible
 void paint(java.awt.Graphics g1)
           
 void paintBorder(java.awt.Graphics g)
           
 void setBorderColor(java.awt.Color borderColor)
           
 void setBorderType(int borderType)
          Set the border type.
 void setImage(java.awt.Image image)
          Set the image
 void setMargin(java.awt.Insets margin)
           
 void setText(java.lang.String text)
          Set the text to display
 void setTextImageGap(int textImageGap)
          Set the gap (in pixels) between the image and text.
 void setTextVisible(boolean textVisible)
          Set whether or not the text is visible
 void update(java.awt.Graphics g)
           
 
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, 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, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, 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, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No border. This will not take up any space.

See Also:
Constant Field Values

LOWERED_BEVEL

public static final int LOWERED_BEVEL
Lowered bevel border (takes up 2 pixels)

See Also:
Constant Field Values

RAISED_BEVEL

public static final int RAISED_BEVEL
Raised bevel border (takes up 2 pixels)

See Also:
Constant Field Values

EMPTY

public static final int EMPTY
Empty space (takes up 2 pixels)

See Also:
Constant Field Values
Constructor Detail

ImageTextLabel

public ImageTextLabel()

ImageTextLabel

public ImageTextLabel(java.awt.Image image,
                      java.lang.String text)
Method Detail

addNotify

public void addNotify()

setTextVisible

public void setTextVisible(boolean textVisible)
Set whether or not the text is visible

Parameters:
textVisible - text visible

isTextVisible

public boolean isTextVisible()
Get whether or not the text is visible

Returns:
text visible

setMargin

public void setMargin(java.awt.Insets margin)

getMargin

public java.awt.Insets getMargin()

paint

public void paint(java.awt.Graphics g1)

doLayout

public void doLayout()

setTextImageGap

public void setTextImageGap(int textImageGap)
Set the gap (in pixels) between the image and text. This will only be take into account if both the image and text are set.

Parameters:
textImageGap - gap in pixels between text and image

getTextImageGap

public int getTextImageGap()
Get the gap (in pixels) between the image and text. This will only be take into account if both the image and text are set.

Returns:
image gap

getImage

public java.awt.Image getImage()
Get the image

Returns:
image

setImage

public void setImage(java.awt.Image image)
Set the image

Parameters:
image - image

getBorderColor

public java.awt.Color getBorderColor()

setBorderColor

public void setBorderColor(java.awt.Color borderColor)

setText

public void setText(java.lang.String text)
Set the text to display

Parameters:
text - text

getText

public java.lang.String getText()
Get the text to display


setBorderType

public void setBorderType(int borderType)
Set the border type. Can be one of :-


getInsets

public java.awt.Insets getInsets()
Return insets sufficient for bevel and label drawing space.


paintBorder

public void paintBorder(java.awt.Graphics g)

update

public void update(java.awt.Graphics g)

getPreferredSize

public java.awt.Dimension getPreferredSize()

getMinimumSize

public java.awt.Dimension getMinimumSize()


Copyright © 2003-2004 3SP LTD. All Rights Reserved.