rvl.awt
Class Bar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by rvl.awt.Bar
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class Bar
extends java.awt.Canvas

GUI object for implementing a bar-graph-style method for I/O of nonnegative quantities. A single mouse click in the active range will set its value.
Typically, several Bar objects will be stacked in a single panel. They share a common scale determined by the BarGroup object passed in the constructor. You will probably want to add the associated BarGroup to the same panel, since it shows the scale values.

See Also:
BarGroup, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
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
protected  java.awt.event.ActionListener actionListener
           
 
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
Bar(java.lang.Object ID, double val, BarGroup grp)
           
Bar(java.lang.Object ID, int val, BarGroup grp)
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
           
 int getIntVal()
           
 double getValue()
           
 java.awt.Dimension minimumSize()
           
 boolean mouseDown(java.awt.Event e, int x, int y)
          public boolean mouseMove(Event e, int x, int y) { if (isHot(x,y)) group.parentFrame.setCursor(Frame.CROSSHAIR_CURSOR); else group.parentFrame.setCursor(Frame.DEFAULT_CURSOR); return true; }
 boolean mouseDrag(java.awt.Event e, int x, int y)
           
 boolean mouseEnter(java.awt.Event e, int x, int y)
           
 boolean mouseExit(java.awt.Event e, int x, int y)
           
 boolean mouseUp(java.awt.Event e, int x, int y)
           
 void paint(java.awt.Graphics g)
           
 java.awt.Dimension preferredSize()
           
 void setValue(double v)
           
 void setValue(int v)
           
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseMove, move, nextFocus, paintAll, paramString, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionListener

protected transient java.awt.event.ActionListener actionListener
Constructor Detail

Bar

public Bar(java.lang.Object ID,
           double val,
           BarGroup grp)
Parameters:
ID - object that will be passed as event-handler argument when a new value is selected
val - initial value
grp - which bar group is used for scaling

Bar

public Bar(java.lang.Object ID,
           int val,
           BarGroup grp)
Parameters:
ID - object that will be passed as event-handler argument when a new value is selected
val - initial value
grp - which bar group is used for scaling
Method Detail

addActionListener

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

getValue

public double getValue()

getIntVal

public int getIntVal()

setValue

public void setValue(double v)

setValue

public void setValue(int v)

preferredSize

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

minimumSize

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

paint

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

mouseEnter

public boolean mouseEnter(java.awt.Event e,
                          int x,
                          int y)
Overrides:
mouseEnter in class java.awt.Component

mouseExit

public boolean mouseExit(java.awt.Event e,
                         int x,
                         int y)
Overrides:
mouseExit in class java.awt.Component

mouseDown

public boolean mouseDown(java.awt.Event e,
                         int x,
                         int y)
public boolean mouseMove(Event e, int x, int y) { if (isHot(x,y)) group.parentFrame.setCursor(Frame.CROSSHAIR_CURSOR); else group.parentFrame.setCursor(Frame.DEFAULT_CURSOR); return true; }

Overrides:
mouseDown in class java.awt.Component

mouseUp

public boolean mouseUp(java.awt.Event e,
                       int x,
                       int y)
Overrides:
mouseUp in class java.awt.Component

mouseDrag

public boolean mouseDrag(java.awt.Event e,
                         int x,
                         int y)
Overrides:
mouseDrag in class java.awt.Component