public class ColorsConfigItem
extends javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private javax.swing.JPanel |
backgroundPanel |
private javax.swing.JButton |
buttonAdjust |
private javax.swing.JButton |
buttonPick |
private javax.swing.JButton |
buttonRestore |
private ColorsConfigItemCallbacks |
callbacks |
private static java.awt.Color |
COLOR_POPUP_BG |
private static java.awt.Color |
COLOR_POPUP_BG_HOVER |
protected java.awt.Color |
colorCurrent |
private java.awt.Color |
colorDefault |
private ColorsChangedListener |
colorsChangedListener |
private static javax.swing.JMenuItem |
EXAMPLE_MENU_ITEM |
private java.lang.String |
fullName |
private IndicatorColorInterface |
indicatorColorInterface |
private javax.swing.JLabel |
label |
private ColorsChangedListener |
listener |
protected java.lang.String |
text |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ColorsConfigItem(java.awt.Color currentColor,
java.awt.Color defaultColor,
java.util.function.Consumer<java.awt.Color> colorChangedListener)
Creates color configuration UI component, similar to the ones Bookmap uses.
|
ColorsConfigItem(java.awt.Color currentColor,
java.awt.Color defaultColor,
java.lang.String label,
java.util.function.Consumer<java.awt.Color> colorChangedListener)
Creates color configuration UI component, similar to the ones Bookmap uses
|
ColorsConfigItem(java.lang.String text,
java.awt.Color defaultColor,
IndicatorColorInterface indicatorColorInterface,
ColorsChangedListener listener) |
ColorsConfigItem(java.lang.String fullName,
java.lang.String text,
boolean showLabel,
java.awt.Color defaultColor,
IndicatorColorInterface indicatorColorInterface,
ColorsChangedListener listener) |
ColorsConfigItem(java.lang.String fullName,
java.lang.String text,
boolean showLabel,
java.awt.Color defaultColor,
IndicatorColorInterface indicatorColorInterface,
ColorsChangedListener listener,
ColorsConfigItemCallbacks callbacks,
boolean styleAsMenuItem) |
ColorsConfigItem(java.lang.String fullName,
java.lang.String text,
boolean showLabel,
java.awt.Color defaultColor,
IndicatorColorInterface indicatorColorInterface,
ColorsChangedListener listener,
ColorsConfigItemCallbacks callbacks,
boolean styleAsMenuItem,
java.awt.Insets insets) |
ColorsConfigItem(java.lang.String fullName,
java.lang.String text,
java.awt.Color defaultColor,
IndicatorColorInterface indicatorColorInterface,
ColorsChangedListener listener) |
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getColor() |
java.lang.String |
getColorConfigName() |
private java.awt.Color |
getColorForColorCurrent() |
javax.swing.JLabel |
getLabel() |
private javax.swing.ImageIcon |
getRestoreIcon() |
private void |
initLayout(boolean showLabel,
boolean styleAsMenuItem,
java.awt.Insets initInsets) |
protected void |
onAdjust() |
void |
onCurrentColorChanged() |
void |
onRestore(boolean call) |
private static java.awt.Color |
removeTransparency(java.awt.Color color) |
void |
setColor(java.awt.Color color,
boolean call) |
void |
setEnabled(boolean enabled) |
void |
updateColor()
Sets current color to match color provided by color interface (to be used in case color was changed externally)
|
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, hide, 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, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final javax.swing.JMenuItem EXAMPLE_MENU_ITEM
private static final java.awt.Color COLOR_POPUP_BG_HOVER
private static final java.awt.Color COLOR_POPUP_BG
private ColorsConfigItemCallbacks callbacks
private final java.awt.Color colorDefault
protected java.awt.Color colorCurrent
private final java.lang.String fullName
protected final java.lang.String text
private ColorsChangedListener listener
private IndicatorColorInterface indicatorColorInterface
private javax.swing.JLabel label
private javax.swing.JButton buttonAdjust
private javax.swing.JButton buttonPick
private javax.swing.JButton buttonRestore
private javax.swing.JPanel backgroundPanel
private ColorsChangedListener colorsChangedListener
public ColorsConfigItem(java.awt.Color currentColor, java.awt.Color defaultColor, java.util.function.Consumer<java.awt.Color> colorChangedListener)
ColorsConfigItem(Color, Color, String, Consumer)
with label set to
null}currentColor
- currently selected color (component will be set to it)defaultColor
- default color (when reset button is pressed it will be applied)colorChangedListener
- called when color is changed (regardless of the way it happens -
reset also counts as color change)public ColorsConfigItem(java.awt.Color currentColor, java.awt.Color defaultColor, java.lang.String label, java.util.function.Consumer<java.awt.Color> colorChangedListener)
currentColor
- currently selected color (component will be set to it)defaultColor
- default color (when reset button is pressed it will be applied)label
- text on the component, null to remove labelcolorChangedListener
- called when color is changed (regardless of the way it happens -
reset also counts as color change)public ColorsConfigItem(java.lang.String fullName, java.lang.String text, boolean showLabel, java.awt.Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener)
fullName
- full color nametext
- text that may be displayed to usershowLabel
- false if text should not be displayed, true otherwisedefaultColor
- if no color is already in settings for this name, this color will be used. Restoring default will use this color.listener
- public ColorsConfigItem(java.lang.String fullName, java.lang.String text, boolean showLabel, java.awt.Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener, ColorsConfigItemCallbacks callbacks, boolean styleAsMenuItem)
fullName
- full color nametext
- text that may be displayed to usershowLabel
- false if text should not be displayed, true otherwisedefaultColor
- if no color is already in settings for this name, this color will be used. Restoring default will use this color.listener
- callbacks
- may be nullstyleAsMenuItem
- if true, item will be styled to put in menupublic ColorsConfigItem(java.lang.String fullName, java.lang.String text, java.awt.Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener)
fullName
- text
- can be null if no labeldefaultColor
- if no color is already in settings for this name, this color will be used. Restoring default will use this color.listener
- colorsManager
- public ColorsConfigItem(java.lang.String text, java.awt.Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener)
public ColorsConfigItem(java.lang.String fullName, java.lang.String text, boolean showLabel, java.awt.Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener, ColorsConfigItemCallbacks callbacks, boolean styleAsMenuItem, java.awt.Insets insets)
fullName
- full color nametext
- text that may be displayed to usershowLabel
- false if text should not be displayed, true otherwisedefaultColor
- if no color is already in settings for this name, this color will be used. Restoring default will use this color.listener
- callbacks
- may be nullstyleAsMenuItem
- if true, item will be styled to put in menupublic java.lang.String getColorConfigName()
public java.awt.Color getColor()
private java.awt.Color getColorForColorCurrent()
private void initLayout(boolean showLabel, boolean styleAsMenuItem, java.awt.Insets initInsets)
private static java.awt.Color removeTransparency(java.awt.Color color)
public void setColor(java.awt.Color color, boolean call)
public void onCurrentColorChanged()
protected void onAdjust()
public void onRestore(boolean call)
private javax.swing.ImageIcon getRestoreIcon()
public javax.swing.JLabel getLabel()
public void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
public void updateColor()