visad.browser
Class Slider
- java.lang.Object
-
- java.awt.Component
-
- visad.browser.Slider
-
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener
public class Slider extends java.awt.Component implements java.awt.event.MouseListener, java.awt.event.MouseMotionListenerA simple slider widget.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intGRIP_BOTTOM_YY-coordinate of bottom of grip.static intGRIP_HEIGHTHeight of grip.static intGRIP_TOP_YY-coordinate of top of grip.static intGRIP_WIDTHWidth of grip.static intLINE_LEVELY-coordinate of slider line.static intSLIDER_PREF_HEIGHTPreferred slider height.static intSLIDER_PREF_WIDTHPreferred slider width.
-
Constructor Summary
Constructors Constructor and Description Slider()Constructs a slider with default value, minimum and maximum.Slider(float value, float min, float max)Constructs a slider with the specified value, minimum and maximum.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddActionListener(java.awt.event.ActionListener l)Adds a listener to be notified of slider changes.floatgetMaximum()Gets maximum slider value.java.awt.DimensiongetMaximumSize()Returns maximum size oa slider.floatgetMinimum()Gets minimum slider value.java.awt.DimensiongetMinimumSize()Returns minimum size of slider.java.awt.DimensiongetPreferredSize()Returns preferred size of slider.floatgetValue()Gets current slider value.static voidmain(java.lang.String[] argv)Main method for testing purposes.voidmouseClicked(java.awt.event.MouseEvent e)Not used.voidmouseDragged(java.awt.event.MouseEvent e)MouseMotionListener method for moving grip.voidmouseEntered(java.awt.event.MouseEvent e)Not used.voidmouseExited(java.awt.event.MouseEvent e)Not used.voidmouseMoved(java.awt.event.MouseEvent e)Not used.voidmousePressed(java.awt.event.MouseEvent e)MouseListener method for moving grip.voidmouseReleased(java.awt.event.MouseEvent e)MouseListener method for moving grip.voidnotifyListeners()Notifies listeners of slider change.voidpaint(java.awt.Graphics g)Draws the slider.voidremoveActionListener(java.awt.event.ActionListener l)Removes a listener to be notified of slider changes.voidrepaint()voidsetActionCommand(java.lang.String cmd)Sets command string for slider change notification.voidsetBounds(float min, float max)Sets minimum and maximum slider values.voidsetBounds(int x, int y, int w, int h)Detects changes in slider width.voidsetMaximumSize(java.awt.Dimension dim)Sets preferred size of slider.voidsetMinimumSize(java.awt.Dimension dim)Sets minimum size of slider.voidsetPreferredSize(java.awt.Dimension dim)Sets preferred size of slider.voidsetValue(float value)Sets current slider value.-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
-
-
-
-
Field Detail
-
SLIDER_PREF_HEIGHT
public static final int SLIDER_PREF_HEIGHT
Preferred slider height.- See Also:
- Constant Field Values
-
SLIDER_PREF_WIDTH
public static final int SLIDER_PREF_WIDTH
Preferred slider width.- See Also:
- Constant Field Values
-
GRIP_WIDTH
public static final int GRIP_WIDTH
Width of grip.- See Also:
- Constant Field Values
-
GRIP_HEIGHT
public static final int GRIP_HEIGHT
Height of grip.- See Also:
- Constant Field Values
-
GRIP_TOP_Y
public static final int GRIP_TOP_Y
Y-coordinate of top of grip.- See Also:
- Constant Field Values
-
GRIP_BOTTOM_Y
public static final int GRIP_BOTTOM_Y
Y-coordinate of bottom of grip.- See Also:
- Constant Field Values
-
LINE_LEVEL
public static final int LINE_LEVEL
Y-coordinate of slider line.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Slider
public Slider()
Constructs a slider with default value, minimum and maximum.
-
Slider
public Slider(float value, float min, float max)Constructs a slider with the specified value, minimum and maximum.
-
-
Method Detail
-
getValue
public float getValue()
Gets current slider value.
-
getMinimum
public float getMinimum()
Gets minimum slider value.
-
getMaximum
public float getMaximum()
Gets maximum slider value.
-
setValue
public void setValue(float value)
Sets current slider value.
-
setBounds
public void setBounds(float min, float max)Sets minimum and maximum slider values.
-
setBounds
public void setBounds(int x, int y, int w, int h)Detects changes in slider width.- Overrides:
setBoundsin classjava.awt.Component
-
addActionListener
public void addActionListener(java.awt.event.ActionListener l)
Adds a listener to be notified of slider changes.
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener l)
Removes a listener to be notified of slider changes.
-
setActionCommand
public void setActionCommand(java.lang.String cmd)
Sets command string for slider change notification.
-
notifyListeners
public void notifyListeners()
Notifies listeners of slider change.
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
MouseListener method for moving grip.- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
MouseListener method for moving grip.- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
Not used.- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
Not used.- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
Not used.- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
MouseMotionListener method for moving grip.- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
Not used.- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns minimum size of slider.- Overrides:
getMinimumSizein classjava.awt.Component
-
setMinimumSize
public void setMinimumSize(java.awt.Dimension dim)
Sets minimum size of slider.- Overrides:
setMinimumSizein classjava.awt.Component
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns preferred size of slider.- Overrides:
getPreferredSizein classjava.awt.Component
-
setPreferredSize
public void setPreferredSize(java.awt.Dimension dim)
Sets preferred size of slider.- Overrides:
setPreferredSizein classjava.awt.Component
-
getMaximumSize
public java.awt.Dimension getMaximumSize()
Returns maximum size oa slider.- Overrides:
getMaximumSizein classjava.awt.Component
-
setMaximumSize
public void setMaximumSize(java.awt.Dimension dim)
Sets preferred size of slider.- Overrides:
setMaximumSizein classjava.awt.Component
-
paint
public void paint(java.awt.Graphics g)
Draws the slider.- Overrides:
paintin classjava.awt.Component
-
repaint
public void repaint()
- Overrides:
repaintin classjava.awt.Component
-
main
public static void main(java.lang.String[] argv)
Main method for testing purposes.
-
-
DMelt 3.0 © DataMelt by jWork.ORG