public class ImageTextLabel extends Canvas
Canvas.AccessibleAWTCanvasComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
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
|
accessibleContext, BOTTOM_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
ImageTextLabel() |
ImageTextLabel(Image image,
String text) |
| Modifier and Type | Method and Description |
|---|---|
void |
addNotify() |
void |
doLayout() |
Color |
getBorderDarkShadowColor() |
Color |
getBorderShadowColor() |
Image |
getImage()
Get the image
|
Insets |
getInsets()
Return insets sufficient for bevel and label drawing space.
|
Insets |
getMargin() |
Dimension |
getMinimumSize() |
Dimension |
getPreferredSize() |
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(Graphics g1) |
void |
paintBorder(Graphics g) |
protected void |
renderComponent(Graphics g,
Dimension d,
boolean enabled) |
void |
setBorderDarkShadowColor(Color borderDarkShadowColor) |
void |
setBorderShadowColor(Color borderShadowColor) |
void |
setBorderType(int borderType)
Set the border type.
|
void |
setFont(Font font) |
void |
setHorizontalAlignment(int horizontalAlignment) |
void |
setImage(Image image)
Set the image
|
void |
setMargin(Insets margin) |
void |
setText(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(Graphics g) |
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategyaction, 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, revalidate, 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, validatepublic static final int NONE
public static final int LOWERED_BEVEL
public static final int RAISED_BEVEL
public static final int EMPTY
public static final int RAISED_ROUNDED
public static final int FLAT
public static final int LEFT_ALIGNMENT
public static final int CENTER_ALIGNMENT
public static final int RIGHT_ALIGNMENT
public void setTextVisible(boolean textVisible)
textVisible - text visiblepublic boolean isTextVisible()
public void setMargin(Insets margin)
public Insets getMargin()
public void setTextImageGap(int textImageGap)
textImageGap - gap in pixels between text and imagepublic int getTextImageGap()
public Image getImage()
public void setImage(Image image)
image - imagepublic Color getBorderShadowColor()
public void setBorderShadowColor(Color borderShadowColor)
public Color getBorderDarkShadowColor()
public void setBorderDarkShadowColor(Color borderDarkShadowColor)
public void setText(String text)
text - textpublic String getText()
text - textpublic void setBorderType(int borderType)
ImageTextLabel.NONEImageTextLabel.LOWEREDImageTextLabel.RAISEDborderType - border typepublic Insets getInsets()
public void paintBorder(Graphics g)
public Dimension getPreferredSize()
getPreferredSize in class Componentpublic Dimension getMinimumSize()
getMinimumSize in class Componentpublic void setHorizontalAlignment(int horizontalAlignment)
Copyright © 2021. All rights reserved.