Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.awt.color.CurveEditCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--ncsa.horizon.awt.color.CurveEditCanvas

public class CurveEditCanvas
extends java.awt.Canvas
implements java.awt.event.ActionListener
A canvas for graphically editing an array of integers.

This class is used by Horizon to edit one color component of an EditableColorModel; however, its design and implementation is fairly general and can be used to edit any array of integers. To edit the array, the class must be provided with an CurveEditMode object which controls how the data is edited.

The canvas plots the current values of the array as a graph. Additional graphics used to edit the curve may be added by the CurveEditMode in use. The CurveEditMode also handles all the mouse events to update the values in the array.

See Also:
Serialized Form

Field Summary
int[] curve
           
CurveEditMode mode
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
CurveEditCanvas()
          create an edit canvas with an initial uneditable state
CurveEditCanvas(int width, int height)
          create an edit canvas with an initial uneditable state
CurveEditCanvas(int[] data, CurveEditMode cem, int width, int height)
          create an edit canvas with a given array of data and a mode for editing it.
 
Method Summary
void actionPerformed(java.awt.event.ActionEvent ev)
           
void addActionListener(java.awt.event.ActionListener l)
           
int[] getCurve()
          return the array this canvas is displaying and editing
CurveEditMode getMode()
          return a reference to the current editing mode
java.awt.Dimension getPreferredSize()
           
static void main(java.lang.String[] args)
           
void paint(java.awt.Graphics g)
           
void removeActionListener(java.awt.event.ActionListener l)
           
void setMode(CurveEditMode cem)
          set the current mode for editing the curve
 
Methods inherited from class java.awt.Canvas
addNotify, paint
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, paramString, postEvent, preferredSize, prepareImage, prepareImage, printAll, print, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

mode

protected CurveEditMode mode

curve

protected int[] curve
Constructor Detail

CurveEditCanvas

public CurveEditCanvas()
create an edit canvas with an initial uneditable state

CurveEditCanvas

public CurveEditCanvas(int width,
                       int height)
create an edit canvas with an initial uneditable state
Parameters:
width - the width of the canvas. A non-positive value means use the default.
height - the height of the canvas. A non-positive value means use the default.

CurveEditCanvas

public CurveEditCanvas(int[] data,
                       CurveEditMode cem,
                       int width,
                       int height)
create an edit canvas with a given array of data and a mode for editing it.
Parameters:
data - the integer array to edit
cem - the editing mode to use
width - the width of the canvas. A non-positive value means use the default.
height - the height of the canvas. A non-positive value means use the default.
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

getCurve

public int[] getCurve()
return the array this canvas is displaying and editing

setMode

public void setMode(CurveEditMode cem)
set the current mode for editing the curve

getMode

public CurveEditMode getMode()
return a reference to the current editing mode

addActionListener

public void addActionListener(java.awt.event.ActionListener l)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Description copied from interface:
 
Specified by:
actionPerformed(java.awt.event.ActionEvent) in interface java.awt.event.ActionListener

main

public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD