Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jplot
Class SwatchPanel  view SwatchPanel download SwatchPanel.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byjplot.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 Class Summary
 
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
 
Field Summary
protected  java.awt.Dimension gap
           
protected  int height
           
(package private)  java.awt.Color[] lowerLeftLineColor
           
protected  int Ns
           
protected  java.awt.Dimension numSwatches
           
protected  java.awt.Dimension swatchSize
           
(package private)  java.awt.Color[] upperRightLineColor
           
protected  int width
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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.Container
 
Fields inherited from class java.awt.Component
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
SwatchPanel()
          Constructs the swatch panel
SwatchPanel(int selectedIndex)
          Constructs the swatch panel
 
Method Summary
 int getColumn(int x)
           
 int getIndex(int x, int y)
           
 java.awt.Dimension getMaximumSize()
          Get the component's maximum size.
 java.awt.Dimension getMinimumSize()
          Get the component's minimum size.
 java.awt.Dimension getPreferredSize()
          Get the component's preferred size.
 int getRow(int y)
           
protected  void initValues()
           
 void paintComponent(java.awt.Graphics g)
          Paint the component's body.
protected  void paintIt(java.awt.Graphics2D g2, int column, int row, int x, int y)
           
protected  void resetBackgrounds()
           
protected  void setSelectedSwatch(int index)
          Presses the swatch with the specified index, which correspond to the actually selected swatch.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

SwatchPanel

public SwatchPanel(int selectedIndex)
Constructs the swatch panel


SwatchPanel

public SwatchPanel()
Constructs the swatch panel

Method Detail

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)