jplot
Class SwatchPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jplot.SwatchPanel
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
- Direct Known Subclasses:
- ColorPanel.ColorSwatches, DashPanel.DashSwatches, PointPanel.PointSwatches
- class SwatchPanel
- extends javax.swing.JPanel
SwatchPanel builds a chooser panel from a series of rectangular
chooseable 'buttons'... Note that this class must be derived in
order to be used properly.
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Fields inherited from class java.awt.Container |
|
|
Constructor Summary |
SwatchPanel()
Constructs the swatch panel |
SwatchPanel(int selectedIndex)
Constructs the swatch panel |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, processMouseEvent, 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 |
swatchSize
protected java.awt.Dimension swatchSize
numSwatches
protected java.awt.Dimension numSwatches
gap
protected java.awt.Dimension gap
Ns
protected int Ns
lowerLeftLineColor
java.awt.Color[] lowerLeftLineColor
upperRightLineColor
java.awt.Color[] upperRightLineColor
width
protected int width
height
protected int height
SwatchPanel
public SwatchPanel(int selectedIndex)
- Constructs the swatch panel
SwatchPanel
public SwatchPanel()
- Constructs the swatch panel
initValues
protected void initValues()
resetBackgrounds
protected void resetBackgrounds()
setSelectedSwatch
protected void setSelectedSwatch(int index)
- Presses the swatch with the specified index, which correspond
to the actually selected swatch.
paintIt
protected void paintIt(java.awt.Graphics2D g2,
int column,
int row,
int x,
int y)
paintComponent
public void paintComponent(java.awt.Graphics g)
- Description copied from class:
javax.swing.JComponent
- Paint the component's body. This usually means calling ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)>
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent) 55 on the JComponent.ui>JComponent.ui 55 property of the component, if
it is non-null. You may override this if you wish to
customize the component's body-painting behavior. The component's body
is painted first, before the border and children.
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Description copied from class:
javax.swing.JComponent
- Get the component's preferred size. If the JComponent.preferredSize>
JComponent.preferredSize 55
property has been explicitly set, it is returned. If the JComponent.preferredSize>JComponent.preferredSize 55 property has not been set but the JComponent.ui>JComponent.ui 55 property
has been, the result of ComponentUI.getPreferredSize(javax.swing.JComponent)>ComponentUI.getPreferredSize(javax.swing.JComponent) 55 is
returned. If neither property has been set, the result of Container.getPreferredSize()>Container.getPreferredSize() 55 is returned.
getMaximumSize
public java.awt.Dimension getMaximumSize()
- Description copied from class:
javax.swing.JComponent
- Get the component's maximum size. If the JComponent.maximumSize>
JComponent.maximumSize 55 property
has been explicitly set, it is returned. If the JComponent.maximumSize>JComponent.maximumSize 55
property has not been set but the JComponent.ui>JComponent.ui 55 property has been, the
result of ComponentUI.getMaximumSize(javax.swing.JComponent)>ComponentUI.getMaximumSize(javax.swing.JComponent) 55 is returned. If neither
property has been set, the result of Container.getMaximumSize()>Container.getMaximumSize() 55
is returned.
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Description copied from class:
javax.swing.JComponent
- Get the component's minimum size. If the JComponent.minimumSize>
JComponent.minimumSize 55 property
has been explicitly set, it is returned. If the JComponent.minimumSize>JComponent.minimumSize 55
property has not been set but the JComponent.ui>JComponent.ui 55 property has been, the
result of ComponentUI.getMinimumSize(javax.swing.JComponent)>ComponentUI.getMinimumSize(javax.swing.JComponent) 55 is returned. If neither
property has been set, the result of Container.getMinimumSize()>Container.getMinimumSize() 55
is returned.
getIndex
public int getIndex(int x,
int y)
getColumn
public int getColumn(int x)
getRow
public int getRow(int y)