Package edu.wisc.ssec.mcidasv.ui
Class PersistableSwatchChooserPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
javax.swing.colorchooser.AbstractColorChooserPanel
edu.wisc.ssec.mcidasv.ui.PersistableSwatchChooserPanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,PropertyChangeListener,Serializable,EventListener,Accessible
public class PersistableSwatchChooserPanel
extends AbstractColorChooserPanel
implements PropertyChangeListener
This has been essentially ripped out of the (wonderful) GNU Classpath
project. Initial implementation of persistable recent colors courtesy of
http://stackoverflow.com/a/11080701
(though I had to hack things up a bit)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class is used to save and restore the recent color choices..(package private) static classThis is the layout manager for the main panel.private classThis class handles the user "selecting" a color using the space key.(package private) static classThis is the main swatch panel.(package private) classThis class handles mouse events for the two swatch panels.(package private) static classThis is the layout manager for the recent swatch panel.private classThis class handles the user "selecting" a recently used color using the space key.(package private) static classThis class is the recent swatch panel.(package private) static classThis the base class for all swatch panels.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescription(package private) PersistableSwatchChooserPanel.MainSwatchPanelThe main panel that holds the set of choosable colors.(package private) KeyListenerMain PaletteKeyListener.(package private) MouseListenerThe mouse handlers for the panels.(package private) PersistableSwatchChooserPanel.RecentSwatchPanelA panel that holds the recent colors.(package private) KeyListenerRecent paletteKeyListener.(package private) PersistableSwatchChooserPanel.ColorTrackerFields inherited from class javax.swing.colorchooser.AbstractColorChooserPanel
TRANSPARENCY_ENABLED_PROPERTYFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new DefaultSwatchChooserPanel object. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis method builds the chooser panel.This method returns the JTabbedPane displayed name.This method returns the large display icon.This method returns the small display icon.This method returns the tooltip text for the given MouseEvent.voidThis method paints the chooser panel with the given Graphics object.voidvoidSet the color tracking object.voiduninstallChooserPanel(JColorChooser chooser) This method removes the chooser panel from the JColorChooser.voidThis method updates the chooser panel with the new value from the JColorChooser.protected voidA method updating the recent colors in the swatchPanel This is called whenever necessary, specifically after building the panel, on changes of the tracker, from the mouseListenerMethods inherited from class javax.swing.colorchooser.AbstractColorChooserPanel
getColorFromModel, getColorSelectionModel, getDisplayedMnemonicIndex, getMnemonic, installChooserPanel, isColorTransparencySelectionEnabled, setColorTransparencySelectionEnabledMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
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, validateTreeMethods inherited from class java.awt.Component
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, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
mainPalette
The main panel that holds the set of choosable colors. -
recentPalette
A panel that holds the recent colors. -
mouseHandler
The mouse handlers for the panels. -
mainSwatchKeyListener
Main PaletteKeyListener. -
recentSwatchKeyListener
Recent paletteKeyListener. -
tracker
-
-
Constructor Details
-
PersistableSwatchChooserPanel
Creates a new DefaultSwatchChooserPanel object.
-
-
Method Details
-
updateChooser
This method updates the chooser panel with the new value from the JColorChooser.- Specified by:
updateChooserin classAbstractColorChooserPanel
-
buildChooser
This method builds the chooser panel.- Specified by:
buildChooserin classAbstractColorChooserPanel
-
uninstallChooserPanel
This method removes the chooser panel from the JColorChooser.- Overrides:
uninstallChooserPanelin classAbstractColorChooserPanel- Parameters:
chooser- The JColorChooser this panel is being removed from.
-
getDisplayName
This method returns the JTabbedPane displayed name.- Specified by:
getDisplayNamein classAbstractColorChooserPanel- Returns:
- The name displayed in the JTabbedPane.
-
getSmallDisplayIcon
This method returns the small display icon.- Specified by:
getSmallDisplayIconin classAbstractColorChooserPanel- Returns:
- The small display icon.
-
getLargeDisplayIcon
This method returns the large display icon.- Specified by:
getLargeDisplayIconin classAbstractColorChooserPanel- Returns:
- The large display icon.
-
paint
This method paints the chooser panel with the given Graphics object.- Overrides:
paintin classAbstractColorChooserPanel- Parameters:
g- The Graphics object to paint with.
-
getToolTipText
This method returns the tooltip text for the given MouseEvent.- Overrides:
getToolTipTextin classJComponent- Parameters:
e- The MouseEvent.- Returns:
- The tooltip text.
-
setColorTracker
Set the color tracking object.- Parameters:
tracker-
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
updateRecentSwatchPanel
A method updating the recent colors in the swatchPanel This is called whenever necessary, specifically after building the panel, on changes of the tracker, from the mouseListener
-