com.sshtools.ui.awt
Class ImageTextLabel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by com.sshtools.ui.awt.ImageTextLabel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
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.

Author:
$Author: brett $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
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
static int CENTER_ALIGNMENT
          Center alignment
static int EMPTY
          Empty space (takes up 2 pixels)
static int FLAT
          Flat (takes up 1 pixel)
static int LEFT_ALIGNMENT
          Left alignment
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)
static int RAISED_ROUNDED
          Raised bevel border (takes up 2 pixels)
static int RIGHT_ALIGNMENT
          Center alignment
 
Fields inherited from class java.awt.Component
BOTTOM_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 getBorderDarkShadowColor()
           
 java.awt.Color getBorderShadowColor()
           
 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)
           
protected  void renderComponent(java.awt.Graphics g, java.awt.Dimension d, boolean enabled)
           
 void setBorderDarkShadowColor(java.awt.Color borderDarkShadowColor)
           
 void setBorderShadowColor(java.awt.Color borderShadowColor)
           
 void setBorderType(int borderType)
          Set the border type.
 void setFont(java.awt.Font font)
           
 void setHorizontalAlignment(int horizontalAlignment)
           
 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, 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, 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, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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

RAISED_ROUNDED

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

See Also:
Constant Field Values

FLAT

public static final int FLAT
Flat (takes up 1 pixel)

See Also:
Constant Field Values

LEFT_ALIGNMENT

public static final int LEFT_ALIGNMENT
Left alignment

See Also:
Constant Field Values

CENTER_ALIGNMENT

public static final int CENTER_ALIGNMENT
Center alignment

See Also:
Constant Field Values

RIGHT_ALIGNMENT

public static final int RIGHT_ALIGNMENT
Center alignment

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()
Overrides:
addNotify in class java.awt.Canvas

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)
Overrides:
paint in class java.awt.Canvas

renderComponent

protected void renderComponent(java.awt.Graphics g,
                               java.awt.Dimension d,
                               boolean enabled)

setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class java.awt.Component

doLayout

public void doLayout()
Overrides:
doLayout in class java.awt.Component

setTextImageGap

public void setTextImageGap(int textImageGap)
Set the gap (in pixels) between the image and text. This will only be taken 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 taken 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

getBorderShadowColor

public java.awt.Color getBorderShadowColor()

setBorderShadowColor

public void setBorderShadowColor(java.awt.Color borderShadowColor)

getBorderDarkShadowColor

public java.awt.Color getBorderDarkShadowColor()

setBorderDarkShadowColor

public void setBorderDarkShadowColor(java.awt.Color borderDarkShadowColor)

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

Parameters:
text - text

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)
Overrides:
update in class java.awt.Canvas

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Component

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Component

setHorizontalAlignment

public void setHorizontalAlignment(int horizontalAlignment)


Copyright © 2003-2009 SSHTOOLS LTD. All Rights Reserved.