gov.noaa.pmel.swing
Class JSlider2Date

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--gov.noaa.pmel.swing.JSlider2Date
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JSlider2Date
extends java.awt.Container
implements java.io.Serializable

Class provides graphical and textual input of a time range. Time calculations are performed using GeoDate. Minimum value are required to be less than or equal to the maximum value. Support has been added for java.util.Date, for both setting the range and getting and setting the slider values.

Version:
$Revision: 1.8 $, $Date: 2000/11/12 19:22:09 $
Author:
Donald Denbo
See Also:
JSlider2, GeoDate, Serialized Form

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
JSlider2Date()
          Default constructor.
JSlider2Date(boolean twoHandles)
          Constructs a single or double time slider.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a property change listener.
 boolean getAlwaysPost()
          Get the always post flag for the slider.
 GeoDate getEndValue()
           
 java.lang.String getFormat()
          Get the format for the slider range label.
 int getHandleSize()
          Get the current slider handle size.
 java.util.Date getMaxDate()
          Get the maximum for the range.
 java.awt.Dimension getMaximumSize()
          Returns the maximum size of this container.
 GeoDate getMaxRange()
          Get the maximum for the range.
 GeoDate getMaxValue()
          Get the maximum handle value
 java.util.Date getMinDate()
          Get the minimum for the range.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size of this container.
 GeoDate getMinRange()
          Get the minimum for the range.
 GeoDate getMinValue()
          Get the minimum handle value
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this container.
 TimeRange getRange()
          Get the slider range.
 boolean getShowBorder()
          Get border status for the slider.
 GeoDate getStartValue()
           
 boolean getTwoHandles()
          Get the two handle flag.
 boolean isTwoHandles()
          Get the two handle flag.
static void main(java.lang.String[] args)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove a property change listener.
 void reset()
          Reset the slider handles
 void setAlwaysPost(boolean ap)
          Set the always post flag for the slider.
 void setEndValue(GeoDate tmax)
           
 void setFormat(java.lang.String frmt)
          Set the format for the slider range label.
 void setHandleSize(int sz)
          Set the handle size for the slider.
 void setMaxDate(java.util.Date dmax)
          Set the maximum for the range.
 void setMaxRange(GeoDate max)
          Set the maximum for the range.
 void setMaxValue(GeoDate tmax)
          Set the maximum handle value.
 void setMinDate(java.util.Date dmin)
          Set the minimum for the range.
 void setMinRange(GeoDate min)
          Set the minimum for the range.
 void setMinValue(GeoDate tmin)
          Set the minimum handle value.
 void setRange(java.util.Date dmin, java.util.Date dmax)
          Set the range for the slider.
 void setRange(GeoDate min, GeoDate max)
          Set the range for the slider.
 void setRange(TimeRange range)
          Set the range for the slider.
 void setShowBorder(boolean sb)
          Show a border around the slider.
 void setSize(java.awt.Dimension dim)
          Resizes this component so that it has width d.width and height d.height.
 void setSize(int w, int h)
          Resizes this component so that it has width width and height.
 void setStartValue(GeoDate tmin)
           
 void setTwoHandles(boolean th)
          Set the two handle mode.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSlider2Date

public JSlider2Date()
Default constructor. The default creates two handles.

JSlider2Date

public JSlider2Date(boolean twoHandles)
Constructs a single or double time slider.
Parameters:
twoHandles - if true create two handles
Method Detail

setRange

public void setRange(GeoDate min,
                     GeoDate max)
Set the range for the slider. The minimum value must be less than the maximum value.
Parameters:
min - minimum value
max - maximum value

setRange

public void setRange(java.util.Date dmin,
                     java.util.Date dmax)
Set the range for the slider. The minimum value must be less than the maximum value.
Parameters:
min - minimum value
max - maximum value

setRange

public void setRange(TimeRange range)
Set the range for the slider. The minimum value must be less than the maximum value.
Parameters:
range - slider time range

getRange

public TimeRange getRange()
Get the slider range.
Returns:
slider range

setMinRange

public void setMinRange(GeoDate min)
Set the minimum for the range.
Parameters:
min - minimum range value

getMinRange

public GeoDate getMinRange()
Get the minimum for the range.
Returns:
minimum range value

setMaxRange

public void setMaxRange(GeoDate max)
Set the maximum for the range.
Parameters:
max - maximum range value

getMaxRange

public GeoDate getMaxRange()
Get the maximum for the range.
Returns:
maximum range value

reset

public void reset()
Reset the slider handles

setTwoHandles

public void setTwoHandles(boolean th)
Set the two handle mode.
Parameters:
th - if true set two handles

getTwoHandles

public boolean getTwoHandles()
Get the two handle flag.
Returns:
true if two handles

isTwoHandles

public boolean isTwoHandles()
Get the two handle flag.
Returns:
true if two handles

setMinDate

public void setMinDate(java.util.Date dmin)
Set the minimum for the range.
Parameters:
dmin - minimum range value

getMinDate

public java.util.Date getMinDate()
Get the minimum for the range.
Parameters:
minimum - range value

setMaxDate

public void setMaxDate(java.util.Date dmax)
Set the maximum for the range.
Parameters:
dmax - maximum range value

getMaxDate

public java.util.Date getMaxDate()
Get the maximum for the range.
Parameters:
maximum - range value

getStartValue

public GeoDate getStartValue()

getEndValue

public GeoDate getEndValue()

setStartValue

public void setStartValue(GeoDate tmin)

setEndValue

public void setEndValue(GeoDate tmax)

setMinValue

public void setMinValue(GeoDate tmin)
Set the minimum handle value.
Parameters:
tmin - minimum handle value

setMaxValue

public void setMaxValue(GeoDate tmax)
Set the maximum handle value.
Parameters:
tmax - maximum handle value

getMinValue

public GeoDate getMinValue()
Get the minimum handle value
Returns:
minimum handle value

getMaxValue

public GeoDate getMaxValue()
Get the maximum handle value
Returns:
maximum handle value

setFormat

public void setFormat(java.lang.String frmt)
Set the format for the slider range label.
Parameters:
frmt - Format in GeoDate syntax
See Also:
GeoDate

getFormat

public java.lang.String getFormat()
Get the format for the slider range label.
Returns:
the format in GeoDate syntax
See Also:
GeoDate

setShowBorder

public void setShowBorder(boolean sb)
Show a border around the slider.
Parameters:
sb - if true show the border

getShowBorder

public boolean getShowBorder()
Get border status for the slider.
Returns:
true if border is showing

setHandleSize

public void setHandleSize(int sz)
Set the handle size for the slider.
Parameters:
sz - handle size in pixels

getHandleSize

public int getHandleSize()
Get the current slider handle size.
Returns:
handle size in pixels

setAlwaysPost

public void setAlwaysPost(boolean ap)
Set the always post flag for the slider. If true any motion of the slider will fire a property change, if false a property change is only caused when the mouse button is released.
Parameters:
ap - if true always post

getAlwaysPost

public boolean getAlwaysPost()
Get the always post flag for the slider.
Returns:
true if the slider will always post

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a property change listener. The properties that fire a property change are "minValue" and "maxValue". The old and new GeoDate objects are set.
Overrides:
addPropertyChangeListener in class java.awt.Component
Parameters:
l - property change listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a property change listener.
Overrides:
removePropertyChangeListener in class java.awt.Component
Parameters:
l - property change listener

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: java.awt.Container
Returns the minimum size of this container.
Overrides:
getMinimumSize in class java.awt.Container
Following copied from class: java.awt.Container
Returns:
an instance of Dimension that represents the minimum size of this container.
See Also:
Container.getPreferredSize(), Container.getLayout(), LayoutManager.minimumLayoutSize(java.awt.Container), Component.getMinimumSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: java.awt.Container
Returns the preferred size of this container.
Overrides:
getPreferredSize in class java.awt.Container
Following copied from class: java.awt.Container
Returns:
an instance of Dimension that represents the preferred size of this container.
See Also:
Container.getMinimumSize(), Container.getLayout(), LayoutManager.preferredLayoutSize(java.awt.Container), Component.getPreferredSize()

getMaximumSize

public java.awt.Dimension getMaximumSize()
Description copied from class: java.awt.Container
Returns the maximum size of this container.
Overrides:
getMaximumSize in class java.awt.Container
Following copied from class: java.awt.Container
See Also:
Container.getPreferredSize()

setSize

public void setSize(java.awt.Dimension dim)
Description copied from class: java.awt.Component
Resizes this component so that it has width d.width and height d.height.
Overrides:
setSize in class java.awt.Component
Following copied from class: java.awt.Component
Parameters:
d - The dimension specifying the new size of this component.
See Also:
Component.setSize(int, int), Component.setBounds(int, int, int, int)

setSize

public void setSize(int w,
                    int h)
Description copied from class: java.awt.Component
Resizes this component so that it has width width and height.
Overrides:
setSize in class java.awt.Component
Following copied from class: java.awt.Component
Parameters:
width - The new width of this component in pixels.
height - The new height of this component in pixels.
See Also:
Component.getSize(), Component.setBounds(int, int, int, int)

main

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


Send comments about the Scientific Graphics toolkit to dwd@pmel.noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on December 13 2001