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 class
This class is used to save and restore the recent color choices..(package private) static class
This is the layout manager for the main panel.private class
This class handles the user "selecting" a color using the space key.(package private) static class
This is the main swatch panel.(package private) class
This class handles mouse events for the two swatch panels.(package private) static class
This is the layout manager for the recent swatch panel.private class
This class handles the user "selecting" a recently used color using the space key.(package private) static class
This class is the recent swatch panel.(package private) static class
This the base class for all swatch panels.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) PersistableSwatchChooserPanel.MainSwatchPanel
The main panel that holds the set of choosable colors.(package private) KeyListener
Main PaletteKeyListener
.(package private) MouseListener
The mouse handlers for the panels.(package private) PersistableSwatchChooserPanel.RecentSwatchPanel
A panel that holds the recent colors.(package private) KeyListener
Recent paletteKeyListener
.(package private) PersistableSwatchChooserPanel.ColorTracker
Fields inherited from class javax.swing.colorchooser.AbstractColorChooserPanel
TRANSPARENCY_ENABLED_PROPERTY
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields 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 void
This 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.void
This method paints the chooser panel with the given Graphics object.void
void
Set the color tracking object.void
uninstallChooserPanel
(JColorChooser chooser) This method removes the chooser panel from the JColorChooser.void
This method updates the chooser panel with the new value from the JColorChooser.protected void
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 mouseListenerMethods inherited from class javax.swing.colorchooser.AbstractColorChooserPanel
getColorFromModel, getColorSelectionModel, getDisplayedMnemonicIndex, getMnemonic, installChooserPanel, isColorTransparencySelectionEnabled, setColorTransparencySelectionEnabled
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods 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, update
Methods 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, validateTree
Methods 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:
updateChooser
in classAbstractColorChooserPanel
-
buildChooser
This method builds the chooser panel.- Specified by:
buildChooser
in classAbstractColorChooserPanel
-
uninstallChooserPanel
This method removes the chooser panel from the JColorChooser.- Overrides:
uninstallChooserPanel
in classAbstractColorChooserPanel
- Parameters:
chooser
- The JColorChooser this panel is being removed from.
-
getDisplayName
This method returns the JTabbedPane displayed name.- Specified by:
getDisplayName
in classAbstractColorChooserPanel
- Returns:
- The name displayed in the JTabbedPane.
-
getSmallDisplayIcon
This method returns the small display icon.- Specified by:
getSmallDisplayIcon
in classAbstractColorChooserPanel
- Returns:
- The small display icon.
-
getLargeDisplayIcon
This method returns the large display icon.- Specified by:
getLargeDisplayIcon
in classAbstractColorChooserPanel
- Returns:
- The large display icon.
-
paint
This method paints the chooser panel with the given Graphics object.- Overrides:
paint
in classAbstractColorChooserPanel
- Parameters:
g
- The Graphics object to paint with.
-
getToolTipText
This method returns the tooltip text for the given MouseEvent.- Overrides:
getToolTipText
in classJComponent
- Parameters:
e
- The MouseEvent.- Returns:
- The tooltip text.
-
setColorTracker
Set the color tracking object.- Parameters:
tracker
-
-
propertyChange
- Specified by:
propertyChange
in 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
-