edu.uah.math.devices
Class Parameter

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.uah.math.devices.Parameter
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener

public class Parameter
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener, java.io.Serializable

This class consists of a slider and a label, and is intended for adjusting the value of a real parameter. The real parameter is characterized by a minimum value, a maximum value, a step size, a current value, a name, and a symbol. The name is intended to be descriptive and is used in the tool tip. The symbol is used in the label.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
Parameter()
          This default constructor creates a new parameter object with min value 0, max value 1, step size 1/10, value 1/2, name "Probability", and symbol "p".
Parameter(double a, double b, double h, double v, java.lang.String n, java.lang.String s)
          This special constructor creates a new parameter object for adjusting a parameter, with default size 175.
Parameter(double a, double b, double h, double v, java.lang.String n, java.lang.String s, int w)
          This general constructor creates a new parameter object for adjusting a parameter.
 
Method Summary
 void applyDecimalPattern(java.lang.String p)
          This method applys the decimal format to be used in the label
 javax.swing.JLabel getLabel()
          This method returns the label.
 double getMax()
          This method gets the maximum value of the parameter.
 java.awt.Dimension getMaximumSize()
          The method specifies that the maximum size should be the same as the preferred size.
 double getMin()
          This method gets the minimum value of the parameter.
 java.awt.Dimension getMinimumSize()
          This method specifies that the minimum size should be the same as the preferred size.
 java.lang.String getName()
          This method returns the name
 java.awt.Dimension getPreferredSize()
          This method sets the width of the preferred size to the specified value.
 javax.swing.JSlider getSlider()
          This method returns the slider.
 int getSteps()
          This method gets the number of steps.
 double getStepSize()
          This method gets the step size of the parameter.
 java.lang.String getSymbol()
          This method returns the symbol
 double getValue()
          This method gets the value of the parameter.
 void setMax(double b)
          This method sets the maximum value of the parameter.
 void setMin(double a)
          This method sets the minimum value of the parameter.
 void setName(java.lang.String n)
          This method sets the name.
 void setProperties(double a, double b, double w, double v, java.lang.String n, java.lang.String s)
          This method sets the range and strings.
 void setRange(double a, double b, double w, double v)
          This method sets the range of the parameter
 void setStepSize(double w)
          This method sets the step size of the parameter.
 void setStrings(java.lang.String n, java.lang.String s)
          This method sets the name and symbol.
 void setSymbol(java.lang.String s)
          This method sets the symbol
 void setValue(double v)
          This method sets the value of the parameter.
 void setWidth(int w)
          This method sets the width of the component in pixels
 void stateChanged(javax.swing.event.ChangeEvent e)
          This method handles the events associated with changing the scrollbar.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, 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, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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, 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, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, 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

Parameter

public Parameter(double a,
                 double b,
                 double h,
                 double v,
                 java.lang.String n,
                 java.lang.String s,
                 int w)
This general constructor creates a new parameter object for adjusting a parameter.

Parameters:
a - the minimum value of the parameter
b - the maximum value of the parameter
h - the step size of the parameter
v - the initial value of the parameter
n - the name of the parameter
s - the symbol used for the parameter
w - the width dimension of the panel containing the slider and label

Parameter

public Parameter(double a,
                 double b,
                 double h,
                 double v,
                 java.lang.String n,
                 java.lang.String s)
This special constructor creates a new parameter object for adjusting a parameter, with default size 175.

Parameters:
a - the minimum value of the parameter
b - the maximum value of the parameter
h - the step size of the parameter
v - the initial value of the parameter
n - the name of the parameter
s - the symbol used for the parameter

Parameter

public Parameter()
This default constructor creates a new parameter object with min value 0, max value 1, step size 1/10, value 1/2, name "Probability", and symbol "p".

Method Detail

setMin

public void setMin(double a)
This method sets the minimum value of the parameter.

Parameters:
a - the minimum value

setMax

public void setMax(double b)
This method sets the maximum value of the parameter.

Parameters:
b - the maximum value

setStepSize

public void setStepSize(double w)
This method sets the step size of the parameter.

Parameters:
w - the step size

setValue

public void setValue(double v)
This method sets the value of the parameter.

Parameters:
v - the value of the parameter

setRange

public void setRange(double a,
                     double b,
                     double w,
                     double v)
This method sets the range of the parameter

Parameters:
a - the minimum value of the parameter
b - the maximum value of the parameter
w - the step size of the parameter
v - the value of the parameter

setProperties

public void setProperties(double a,
                          double b,
                          double w,
                          double v,
                          java.lang.String n,
                          java.lang.String s)
This method sets the range and strings.

Parameters:
a - the minimum value of the parameter
b - the maximum value of the parameter
w - the step size of the parameter
v - the value of the parameter
n - the name of the parameter
s - the symbol of the parameter

setStrings

public void setStrings(java.lang.String n,
                       java.lang.String s)
This method sets the name and symbol.

Parameters:
n - the name of the parameter
s - the symbol of the parameter

setName

public void setName(java.lang.String n)
This method sets the name.

Overrides:
setName in class java.awt.Component
Parameters:
n - the name of the parameter

getName

public java.lang.String getName()
This method returns the name

Overrides:
getName in class java.awt.Component
Returns:
the name of the parameter

setSymbol

public void setSymbol(java.lang.String s)
This method sets the symbol

Parameters:
s - the symbol of the parameter

getSymbol

public java.lang.String getSymbol()
This method returns the symbol

Returns:
the symbol of the parameter

setWidth

public void setWidth(int w)
This method sets the width of the component in pixels

Parameters:
w - the width

getValue

public double getValue()
This method gets the value of the parameter.

Returns:
the value of the parameter

getMin

public double getMin()
This method gets the minimum value of the parameter.

Returns:
the minimum value of the parameter

getMax

public double getMax()
This method gets the maximum value of the parameter.

Returns:
the maximum value of the parameter

getStepSize

public double getStepSize()
This method gets the step size of the parameter.

Returns:
the step size of the parameter

getSteps

public int getSteps()
This method gets the number of steps.

Returns:
the number of steps between the minimum and maximum values

getSlider

public javax.swing.JSlider getSlider()
This method returns the slider.

Returns:
the slider

getLabel

public javax.swing.JLabel getLabel()
This method returns the label.

Returns:
the label

applyDecimalPattern

public void applyDecimalPattern(java.lang.String p)
This method applys the decimal format to be used in the label

Parameters:
p - the decimal pattern.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
This method handles the events associated with changing the scrollbar. The value of the parameter is shown in the label.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - the change event

getMinimumSize

public java.awt.Dimension getMinimumSize()
This method specifies that the minimum size should be the same as the preferred size.

Overrides:
getMinimumSize in class javax.swing.JComponent
Returns:
the dimension object corresponding to the preferred size.

getPreferredSize

public java.awt.Dimension getPreferredSize()
This method sets the width of the preferred size to the specified value.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
the dimesnion object corresponding to the preferred size.

getMaximumSize

public java.awt.Dimension getMaximumSize()
The method specifies that the maximum size should be the same as the preferred size.

Overrides:
getMaximumSize in class javax.swing.JComponent
Returns:
the dimension object corresponding to the preferred size.