public class SimpleColoredComponent
extends javax.swing.JComponent
implements javax.accessibility.Accessible
Modifier and Type | Class and Description |
---|---|
protected class |
SimpleColoredComponent.AccessibleSimpleColoredComponent |
static class |
SimpleColoredComponent.BrowserLauncherTag |
static interface |
SimpleColoredComponent.ColoredIterator |
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
FRAGMENT_ICON |
protected int |
myIconTextGap
Gap between icon and text.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
SimpleColoredComponent() |
Modifier and Type | Method and Description |
---|---|
SimpleColoredComponent |
append(java.lang.String fragment) |
void |
append(java.lang.String fragment,
SimpleTextAttributes attributes)
Appends string fragments to existing ones.
|
void |
append(java.lang.String fragment,
SimpleTextAttributes attributes,
boolean isMainText)
Appends string fragments to existing ones.
|
void |
append(java.lang.String fragment,
SimpleTextAttributes attributes,
int padding,
int align)
Appends text fragment and sets it's end offset and alignment.
|
void |
append(java.lang.String fragment,
SimpleTextAttributes attributes,
java.lang.Object tag) |
void |
appendTextPadding(int padding) |
void |
appendTextPadding(int padding,
int align) |
protected void |
applyAdditionalHints(java.awt.Graphics2D g) |
void |
change(java.lang.Runnable runnable,
boolean autoInvalidate) |
void |
clear()
Clear all special attributes of
SimpleColoredComponent . |
java.awt.Dimension |
computePreferredSize(boolean mainTextOnly) |
protected void |
doPaint(java.awt.Graphics2D g) |
protected void |
doPaintFragmentBackground(java.awt.Graphics2D g,
int index,
java.awt.Color bgColor,
int x,
int y,
int width,
int height) |
protected void |
doPaintIcon(java.awt.Graphics2D g,
javax.swing.Icon icon,
int offset) |
protected int |
doPaintText(java.awt.Graphics2D g,
int textStart,
boolean focusAroundIcon) |
int |
findFragmentAt(int x)
Returns the index of text fragment at the specified X offset.
|
protected javax.swing.JLabel |
formatToLabel(javax.swing.JLabel label) |
javax.accessibility.AccessibleContext |
getAccessibleContext() |
protected java.awt.Color |
getActiveTextColor(java.awt.Color attributesColor) |
int |
getBaseline(int width,
int height) |
java.lang.CharSequence |
getCharSequence(boolean mainOnly) |
java.lang.Object |
getFragmentTag(int index) |
java.lang.Object |
getFragmentTagAt(int x) |
javax.swing.Icon |
getIcon() |
int |
getIconTextGap() |
java.awt.Insets |
getIpad() |
protected int |
getMinHeight() |
java.awt.Dimension |
getMinimumSize() |
javax.swing.border.Border |
getMyBorder() |
java.awt.Dimension |
getPreferredSize() |
static int |
getTextBaseLine(java.awt.FontMetrics metrics,
int height) |
boolean |
isIconOnTheRight() |
boolean |
isIconOpaque() |
boolean |
isTransparentIconBackground() |
SimpleColoredComponent.ColoredIterator |
iterator() |
SimpleColoredComponent.ColoredIterator |
iterator(int fromIndex) |
protected void |
paintBackground(java.awt.Graphics2D g,
int x,
int width,
int height) |
protected void |
paintComponent(java.awt.Graphics g) |
protected void |
paintIcon(java.awt.Graphics g,
javax.swing.Icon icon,
int offset) |
protected void |
setBorderInsets(java.awt.Insets insets) |
protected void |
setFocusBorderAroundIcon(boolean focusBorderAroundIcon)
Sets whether focus border extends to icon or not.
|
void |
setIcon(javax.swing.Icon icon)
Sets a new component icon
|
void |
setIconOnTheRight(boolean iconOnTheRight) |
void |
setIconOpaque(boolean iconOpaque) |
void |
setIconTextGap(int iconTextGap)
Sets a new gap between icon and text
|
void |
setIpad(java.awt.Insets ipad)
Sets specified internal paddings
|
void |
setMyBorder(javax.swing.border.Border border) |
protected void |
setPaintFocusBorder(boolean paintFocusBorder)
Sets whether focus border is painted or not
|
void |
setTextAlign(int align) |
void |
setTransparentIconBackground(boolean transparentIconBackground) |
protected boolean |
shouldDrawBackground() |
protected boolean |
shouldDrawDimmed() |
protected boolean |
shouldDrawMacShadow()
Deprecated.
and won't be used anymore
|
java.lang.String |
toString() |
void |
updateUI() |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int FRAGMENT_ICON
protected int myIconTextGap
public void updateUI()
updateUI
in class javax.swing.JComponent
public SimpleColoredComponent.ColoredIterator iterator()
public SimpleColoredComponent.ColoredIterator iterator(int fromIndex)
public boolean isIconOnTheRight()
public void setIconOnTheRight(boolean iconOnTheRight)
public final SimpleColoredComponent append(java.lang.String fragment)
public final void append(java.lang.String fragment, SimpleTextAttributes attributes)
attributes
.fragment
- text fragmentattributes
- text attributespublic final void append(java.lang.String fragment, SimpleTextAttributes attributes, int padding, int align)
fragment
- text fragmentattributes
- text attributespadding
- end offset of the textalign
- alignment between current offset and paddingpublic void append(java.lang.String fragment, SimpleTextAttributes attributes, boolean isMainText)
attributes
.fragment
- text fragmentattributes
- text attributesisMainText
- main text of notpublic void append(java.lang.String fragment, SimpleTextAttributes attributes, java.lang.Object tag)
public void appendTextPadding(int padding)
public void appendTextPadding(int padding, int align)
padding
- end offset that will be set after drawing current text fragmentalign
- alignment of the current text fragment, if it is SwingConstants.RIGHT
or SwingConstants.TRAILING then the text fragment will be aligned to the right at
the padding, otherwise it will be aligned to the leftpublic void setTextAlign(int align)
public void clear()
SimpleColoredComponent
.
They are icon, text fragments and their attributes, "paint focus border".public final javax.swing.Icon getIcon()
null
if there is no icon.public final void setIcon(javax.swing.Icon icon)
icon
- iconpublic java.awt.Insets getIpad()
public void setIpad(java.awt.Insets ipad)
ipad
- insetspublic int getIconTextGap()
public void setIconTextGap(int iconTextGap)
iconTextGap
- the gap between text and iconjava.lang.IllegalArgumentException
- if the iconTextGap
has a negative valuepublic javax.swing.border.Border getMyBorder()
public void setMyBorder(javax.swing.border.Border border)
protected final void setPaintFocusBorder(boolean paintFocusBorder)
paintFocusBorder
- true
or false
protected final void setFocusBorderAroundIcon(boolean focusBorderAroundIcon)
focusBorderAroundIcon
- true
or false
public boolean isIconOpaque()
public void setIconOpaque(boolean iconOpaque)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.lang.Object getFragmentTag(int index)
public final java.awt.Dimension computePreferredSize(boolean mainTextOnly)
protected int getMinHeight()
public int findFragmentAt(int x)
x
- the offsetFRAGMENT_ICON
if the icon is at the offset, or -1 if nothing is there.public java.lang.Object getFragmentTagAt(int x)
protected javax.swing.JLabel formatToLabel(javax.swing.JLabel label)
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
protected void doPaint(java.awt.Graphics2D g)
protected void paintBackground(java.awt.Graphics2D g, int x, int width, int height)
protected void doPaintIcon(java.awt.Graphics2D g, javax.swing.Icon icon, int offset)
protected int doPaintText(java.awt.Graphics2D g, int textStart, boolean focusAroundIcon)
protected java.awt.Color getActiveTextColor(java.awt.Color attributesColor)
protected void doPaintFragmentBackground(java.awt.Graphics2D g, int index, java.awt.Color bgColor, int x, int y, int width, int height)
@Deprecated protected boolean shouldDrawMacShadow()
protected boolean shouldDrawDimmed()
protected boolean shouldDrawBackground()
protected void paintIcon(java.awt.Graphics g, javax.swing.Icon icon, int offset)
protected void applyAdditionalHints(java.awt.Graphics2D g)
public int getBaseline(int width, int height)
getBaseline
in class javax.swing.JComponent
public boolean isTransparentIconBackground()
public void setTransparentIconBackground(boolean transparentIconBackground)
public static int getTextBaseLine(java.awt.FontMetrics metrics, int height)
protected void setBorderInsets(java.awt.Insets insets)
public java.lang.CharSequence getCharSequence(boolean mainOnly)
public java.lang.String toString()
toString
in class java.awt.Component
public void change(java.lang.Runnable runnable, boolean autoInvalidate)
public javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext
in interface javax.accessibility.Accessible
getAccessibleContext
in class java.awt.Component