public class LegendItem
extends javax.swing.JPanel
Legend
.
LegendItem(String, String, String, Icon)
.createCircleIcon(Color, Color, int)
, createLineIcon(Color, int)
, createRectangleIcon(Color, Color, int)
to create predefined icons or load custom icons by using ImageIcon
.
getGroupName()
to get the name of the group the item is associated with. The items of a group can be hidden
if the user collapse the group meaning that he does not want to see the items of the group anymore until he expands the group
again.javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
LINETYPE_BOTTOMLEFT_TO_TOPRIGHT
the orientation of an icon content: from bottom left to top right (diagonal)
|
static int |
LINETYPE_LEFT_TO_RIGHT
the orientation of an icon content: from left to right
|
static int |
LINETYPE_TOP_TO_BOTTOM
the orientation of an icon content: from top to bottom
|
static int |
LINETYPE_TOPLEFT_TO_BOTTOMRIGHT
the orientation of an icon content: from top left to bottom right (diagonal)
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
LegendItem(java.lang.String itemName,
java.lang.String groupName,
java.lang.String text)
Creates a new legend item.
|
LegendItem(java.lang.String itemName,
java.lang.String groupName,
java.lang.String text,
javax.swing.Icon icon)
Creates a new legend item.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addImpl(java.awt.Component component,
java.lang.Object constraints,
int index) |
static javax.swing.Icon |
createCircleIcon(java.awt.Color background,
java.awt.Color foreground,
int edgeWidth)
Creates a circle icon.
|
static javax.swing.Icon |
createCircleIcon(java.awt.Color background,
java.awt.Color foreground,
int edgeWidth,
int width,
int height)
Creates a circle icon.
|
static javax.swing.Icon |
createLineIcon(java.awt.Color color,
int lineWidth)
Creates a line icon with a default line type of
LINETYPE_LEFT_TO_RIGHT . |
static javax.swing.Icon |
createLineIcon(java.awt.Color color,
int lineWidth,
int lineType)
Creates a line icon.
|
static javax.swing.Icon |
createLineIcon(java.awt.Color color,
int lineWidth,
int lineType,
int width,
int height)
Creates a line icon.
|
static javax.swing.Icon |
createRectangleIcon(java.awt.Color background,
java.awt.Color foreground,
int edgeWidth)
Creates a rectangle icon.
|
static javax.swing.Icon |
createRectangleIcon(java.awt.Color background,
java.awt.Color foreground,
int edgeWidth,
int width,
int height)
Creates a rectangle icon.
|
java.awt.Font |
getFont()
Gets the font of the group.
|
java.lang.String |
getGroupName()
Gets the name of the group.
|
java.lang.String |
getItemName()
Gets the name of the item.
|
void |
removeAll()
The components of an item may not be removed meaning this method does nothing!
|
void |
setFont(java.awt.Font font)
Sets the font of the group.
|
void |
setLayout(java.awt.LayoutManager mgr)
The layout of an item group may not be changed meaning this method does nothing!
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int LINETYPE_LEFT_TO_RIGHT
public static final int LINETYPE_TOP_TO_BOTTOM
public static final int LINETYPE_TOPLEFT_TO_BOTTOMRIGHT
public static final int LINETYPE_BOTTOMLEFT_TO_TOPRIGHT
public LegendItem(java.lang.String itemName, java.lang.String groupName, java.lang.String text) throws java.lang.IllegalArgumentException
itemName
- the name of the item by what it is identified in a Legend
(has to be unique based on the corresponding legend)groupName
- the name of the group this item is related to or an empty string if the item should appear in the default group at the beginning of the legendtext
- the text of the item (you can use html tags to format the text)java.lang.IllegalArgumentException
- public LegendItem(java.lang.String itemName, java.lang.String groupName, java.lang.String text, javax.swing.Icon icon) throws java.lang.IllegalArgumentException
itemName
- the name of the item by what it is identified in a Legend
(has to be unique based on the corresponding legend)groupName
- the name of the group this item is related to or an empty string if the item should appear in the default group at the beginning of the legendtext
- the text of the item (you can use html tags to format the text)icon
- the icon of the item (use createCircleIcon(Color, Color, int)
, createLineIcon(Color, int)
, ... to create predefined icons) or null
java.lang.IllegalArgumentException
- public final java.lang.String getItemName()
public final java.lang.String getGroupName()
public java.awt.Font getFont()
getFont
in interface java.awt.MenuContainer
getFont
in class java.awt.Component
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
font
- the fontpublic void setLayout(java.awt.LayoutManager mgr)
setLayout
in class java.awt.Container
mgr
- the layout managerpublic void removeAll()
removeAll
in class java.awt.Container
protected void addImpl(java.awt.Component component, java.lang.Object constraints, int index)
addImpl
in class java.awt.Container
public static javax.swing.Icon createCircleIcon(java.awt.Color background, java.awt.Color foreground, int edgeWidth) throws java.lang.IllegalArgumentException
background
- the background color of the circleforeground
- the foreground color of the circleedgeWidth
- the line width of the edgejava.lang.IllegalArgumentException
- <0
public static javax.swing.Icon createCircleIcon(java.awt.Color background, java.awt.Color foreground, int edgeWidth, int width, int height) throws java.lang.IllegalArgumentException
background
- the background color of the circleforeground
- the foreground color of the circleedgeWidth
- the line width of the edgewidth
- the width of the iconheight
- the height of the iconjava.lang.IllegalArgumentException
- <0
<0
<0
public static javax.swing.Icon createLineIcon(java.awt.Color color, int lineWidth) throws java.lang.IllegalArgumentException
LINETYPE_LEFT_TO_RIGHT
.color
- the color of the linelineWidth
- the line widthjava.lang.IllegalArgumentException
- <0
public static javax.swing.Icon createLineIcon(java.awt.Color color, int lineWidth, int lineType) throws java.lang.IllegalArgumentException
color
- the color of the linelineWidth
- the line widthlineType
- the line type like LINETYPE_LEFT_TO_RIGHT
, LINETYPE_TOP_TO_BOTTOM
, ...java.lang.IllegalArgumentException
- <0
public static javax.swing.Icon createLineIcon(java.awt.Color color, int lineWidth, int lineType, int width, int height) throws java.lang.IllegalArgumentException
color
- the color of the linelineWidth
- the line widthlineType
- the line type like LINETYPE_LEFT_TO_RIGHT
, LINETYPE_TOP_TO_BOTTOM
, ...width
- the width of the iconheight
- the height of the iconjava.lang.IllegalArgumentException
- <0
<0
<0
public static javax.swing.Icon createRectangleIcon(java.awt.Color background, java.awt.Color foreground, int edgeWidth) throws java.lang.IllegalArgumentException
background
- the background color of the rectangleforeground
- the foreground color of the rectangleedgeWidth
- the line width of the edgejava.lang.IllegalArgumentException
- <0
public static javax.swing.Icon createRectangleIcon(java.awt.Color background, java.awt.Color foreground, int edgeWidth, int width, int height) throws java.lang.IllegalArgumentException
background
- the background color of the rectangleforeground
- the foreground color of the rectangleedgeWidth
- the line width of the edgewidth
- the width of the iconheight
- the height of the iconjava.lang.IllegalArgumentException
- <0
<0
<0