org.jscience.swing
Class JContourPlot

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.jscience.swing.JDoubleBufferedComponent
                  extended by org.jscience.swing.JContourPlot
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, ColorScheme

public final class JContourPlot
extends JDoubleBufferedComponent
implements ColorScheme

A contour plot Swing component.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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.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
JContourPlot(double[][] z)
          Constructs a contour plot.
 
Method Summary
 java.awt.Color getColor(float f)
          DOCUMENT ME!
 java.awt.Dimension getMinimumSize()
          Returns the minimum size of this component.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this component.
protected  void offscreenPaint(java.awt.Graphics g)
          Paint the graph.
 void setBounds(int x, int y, int width, int height)
          DOCUMENT ME!
 void setColor(float x1, float x2, float x3)
          Set the color for the contour of the graph.
 void setColorScheme(ColorScheme cs)
          DOCUMENT ME!
 void setContourX(int k)
          There is a box around the graph, this sets how wide it will be in the horizontal direction.
 void setContourY(int k)
          There is a box around the graph, this sets how wide it will be in the vertical direction.
 void setData(double[][] feed)
          Sets the data plotted by this JContourPlot to the specified data.
 
Methods inherited from class org.jscience.swing.JDoubleBufferedComponent
getOffscreenGraphics, isDoubleBuffered, paintComponent, printComponent, redraw, setDoubleBuffered, update
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JContourPlot

public JContourPlot(double[][] z)
Constructs a contour plot.

Parameters:
z - an array of the form z[i][j] = f(xi, yj).
Method Detail

setData

public void setData(double[][] feed)
Sets the data plotted by this JContourPlot to the specified data.

Parameters:
feed - DOCUMENT ME!

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of this component.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
DOCUMENT ME!

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size of this component.

Overrides:
getMinimumSize in class javax.swing.JComponent
Returns:
DOCUMENT ME!

setContourX

public void setContourX(int k)
There is a box around the graph, this sets how wide it will be in the horizontal direction.

Parameters:
k - width (in pixel)
Throws:
java.lang.IllegalArgumentException - if the width is not at least one.

setContourY

public void setContourY(int k)
There is a box around the graph, this sets how wide it will be in the vertical direction.

Parameters:
k - width (in pixel).
Throws:
java.lang.IllegalArgumentException - if the width is not at least one.

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
DOCUMENT ME!

Overrides:
setBounds in class java.awt.Component
Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
width - DOCUMENT ME!
height - DOCUMENT ME!

setColor

public void setColor(float x1,
                     float x2,
                     float x3)
Set the color for the contour of the graph.

Parameters:
x1 - DOCUMENT ME!
x2 - DOCUMENT ME!
x3 - DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - if one of the parameters is not between 0 and 1.

getColor

public java.awt.Color getColor(float f)
DOCUMENT ME!

Specified by:
getColor in interface ColorScheme
Parameters:
f - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

setColorScheme

public void setColorScheme(ColorScheme cs)
DOCUMENT ME!

Parameters:
cs - DOCUMENT ME!

offscreenPaint

protected void offscreenPaint(java.awt.Graphics g)
Paint the graph.

Specified by:
offscreenPaint in class JDoubleBufferedComponent
Parameters:
g - DOCUMENT ME!