public class SliderAndSpinnerPanel
extends javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
changed
Used to pass information between the slider and the spinner objects.
|
private java.lang.String |
label
The panel's label.
|
private int |
max
The maximum allowed value
|
private int |
min
The minimum allowed value.
|
private javax.swing.JSlider |
slider
The slider object.
|
private javax.swing.JSpinner |
spinner
The spinner object.
|
private int |
stepSize
The difference between two consecutive values.
|
private int |
value
The current value.
|
private int |
width
Width of the panel.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
SliderAndSpinnerPanel(java.lang.String label,
int min,
int max,
int value,
int stepSize,
int width)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
createPanel()
Creates and locates the slicder and the spinner.
|
int |
getMaximum()
Returns the maximum value supported by the panel.
|
int |
getMinimum()
Returns the minimum value supported by the panel.
|
int |
getStepSize()
Returns the size of the value change..
|
int |
getValue()
Returns the current value.
|
void |
setEnabled(boolean enabled) |
void |
setLabelTable(int labels) |
void |
setMajorTickSpacing(int majorTick) |
void |
setMaximum(int maximum)
Sets the maximum value to
maximum . |
void |
setMinimum(int minimum)
Sets the minimum value to
minimum . |
void |
setMinorTickSpacing(int minorTick) |
void |
setRangeProperties(int min,
int max,
int value,
int stepSize)
Sets the panel properties.
|
void |
setSnapToTicks(boolean b)
Definition in
JSlider.setSnapToTicks(boolean) . |
void |
setStepSize(int stepSize)
Sets the step size value to
stepSize . |
void |
setValue(int n)
Sets the current value to
n . |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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, transferFocusDownCycle, validate, validateTree
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, getName, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private java.lang.String label
private int min
private int max
private int value
private int stepSize
private int width
private javax.swing.JSlider slider
private javax.swing.JSpinner spinner
boolean changed
public SliderAndSpinnerPanel(java.lang.String label, int min, int max, int value, int stepSize, int width)
label
- the panel name.min
- the minimum value of the slider.max
- the maximum value of the slider.value
- the initial value of the slider.stepSize
- the difference between elements of the sequence.java.lang.IllegalArgumentException
- if the following expression is false: minimum <= value <= maximumpublic void setMinimum(int minimum)
minimum
.minimum
- the new minimum.java.lang.IllegalArgumentException
- if the minimum is greather than the maximum.public void setRangeProperties(int min, int max, int value, int stepSize)
min
- the minimum value of the slider.max
- the maximum value of the slider.value
- the initial value of the slider.stepSize
- the difference between elements of the sequence.java.lang.IllegalArgumentException
- if the following expression is false: minimum <= value <= maximum.public void setMaximum(int maximum)
maximum
.maximum
- the new maximum.java.lang.IllegalArgumentException
- if the minimum is greather than the maximum.public void setValue(int n)
n
.n
- the new minimum.java.lang.IllegalArgumentException
- if the value is not between the minimum
and the maximum.public void setStepSize(int stepSize)
stepSize
.stepSize
- the new stepSize.public int getMinimum()
public int getMaximum()
public int getValue()
public int getStepSize()
stepSize
property.public void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
public void setSnapToTicks(boolean b)
JSlider.setSnapToTicks(boolean)
.public void setMajorTickSpacing(int majorTick)
public void setMinorTickSpacing(int minorTick)
public void setLabelTable(int labels)
private void createPanel()
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)