visad.util
Class ColorWidget

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by visad.util.ColorWidget
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ColorChangeListener

public class ColorWidget
extends Applet
implements ColorChangeListener

A color widget that allows users to interactively map numeric data to RGBA tuples based on the Vis5D color widget

Since:
Visad Utility Library, 0.5
Version:
$Revision: 1.15 $, $Date: 2002-06-28 15:59:02 $
Author:
Nick Rasmussen nick@cae.wisc.edu
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
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
 
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
ColorWidget()
          Construct a color widget with a ColorPreview and the default ColorMap
ColorWidget(boolean preview)
          Construct a color widget with the default ColorMap
ColorWidget(ColorMap map)
          Construct a color widget with a ColorPreview and the specified ColorMap
ColorWidget(ColorMap map, boolean preview)
          Construct a color widget with the desired ColorMap and ColorPreview visibility
 
Method Summary
 void addColorChangeListener(ColorChangeListener c)
          Add a ColorChangeListener to the listeners list
 void colorChanged(ColorChangeEvent e)
          Listen to the ColorMap and re-dispatch the ColorChangeEvents to the ColorChangeListeners listening to the widget
 ColorMap getColorMap()
          Returns the ColorMap that the color wdget is curently pointing to
 Dimension getPreferredSize()
          Analyses the visible components and determines the preferred size
 void hidePreview()
          Hide the preview bar at the bottom of the widget
static void main(String[] argv)
          main method for standalone testing
protected  void notifyListeners(ColorChangeEvent e)
          Notify the ColorChangeListerers that the color widget has changed
 void removeColorChangeListener(ColorChangeListener c)
          Remove a ColorChangeListener from the listeners list
 void setColorMap(ColorMap map)
          Set the ColorWidget to listen to a specific ColorMap
 void showPreview()
          Make the preview bar at the bottom of the widget visible
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, 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

ColorWidget

public ColorWidget()
            throws RemoteException,
                   VisADException
Construct a color widget with a ColorPreview and the default ColorMap

Throws:
RemoteException
VisADException

ColorWidget

public ColorWidget(boolean preview)
            throws RemoteException,
                   VisADException
Construct a color widget with the default ColorMap

Parameters:
preview - indicates wether or not the preview bar at the bottom of the widget should be present
Throws:
RemoteException
VisADException

ColorWidget

public ColorWidget(ColorMap map)
Construct a color widget with a ColorPreview and the specified ColorMap

Parameters:
map - the ColorMap for the widget to use

ColorWidget

public ColorWidget(ColorMap map,
                   boolean preview)
Construct a color widget with the desired ColorMap and ColorPreview visibility

Parameters:
map - the ColorMap for the widget to use
preview - indicates wether or not the preview bar at the bottom of the widget should be present
Method Detail

main

public static void main(String[] argv)
                 throws RemoteException,
                        VisADException
main method for standalone testing

Throws:
RemoteException
VisADException

addColorChangeListener

public void addColorChangeListener(ColorChangeListener c)
Add a ColorChangeListener to the listeners list


removeColorChangeListener

public void removeColorChangeListener(ColorChangeListener c)
Remove a ColorChangeListener from the listeners list


notifyListeners

protected void notifyListeners(ColorChangeEvent e)
Notify the ColorChangeListerers that the color widget has changed


colorChanged

public void colorChanged(ColorChangeEvent e)
Listen to the ColorMap and re-dispatch the ColorChangeEvents to the ColorChangeListeners listening to the widget

Specified by:
colorChanged in interface ColorChangeListener

setColorMap

public void setColorMap(ColorMap map)
Set the ColorWidget to listen to a specific ColorMap


showPreview

public void showPreview()
Make the preview bar at the bottom of the widget visible


hidePreview

public void hidePreview()
Hide the preview bar at the bottom of the widget


getColorMap

public ColorMap getColorMap()
Returns the ColorMap that the color wdget is curently pointing to


getPreferredSize

public Dimension getPreferredSize()
Analyses the visible components and determines the preferred size

Overrides:
getPreferredSize in class Container