Class JSlider
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, FieldReconciler.Reconcilable
JSlider, rendered by SJSlider (SD_sjslider).
Every getter answers from emulator-owned state and never reads the peer, so it works
on any thread without a hop. Value, minimum, maximum and extent live in the
BoundedRangeModel, which the emulator and the surrogate share: the
emulator reads and writes the model as the JDK does, and the surrogate renders it from
its own model listener. changeListener subscribes to the model directly, as
the JDK's does, so a worker moving the model hears its ChangeEvent on the
worker. The JDK's protected fields and the private flags are Swing-side fields per
D_field_write_reconcile, pushed to the surrogate through withPeer. The surrogate
keeps its own copies, because it renders and snaps from them.
R_leaf_peer_lockdown-locked-down (JDK leaf — private peer ctor).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChangeEventLazily created byfireStateChanged(), as in the JDK.protected ChangeListenerThe listenercreateChangeListener()produced, subscribed to the model throughmodelRelay.protected intprotected intprotected intprotected BoundedRangeModelprotected booleanFields inherited from class JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, FILL_CHROME, FILL_DEFAULT, LEFT_ALIGNMENT, listenerList, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected ChangeListenerJDK hook: the listener subscribed to the model, which re-fires as this slider.createStandardLabels(int increment) Logs the rendering deferral WARN and returns an empty table, since tick labels do not render (SD_sjslider).createStandardLabels(int increment, int start) Two-argument form ofcreateStandardLabels(int), with the same deferral.protected voidintbooleanintintintintgetModel()intbooleanbooleanbooleanbooleangetUI()intgetValue()booleanbooleanimageUpdate(Image img, int infoflags, int x, int y, int w, int h) protected Stringfinal voidD_field_write_reconcile repair hook — compares each JDK-shaped protected field against what was last pushed to the peer and re-pushes on mismatch, logging the ERROR.voidvoidsetExtent(int extent) voidvoidsetInverted(boolean b) voidsetLabelTable(Dictionary labels) voidsetMajorTickSpacing(int n) voidsetMaximum(int maximum) voidsetMinimum(int minimum) voidsetMinorTickSpacing(int n) voidsetModel(BoundedRangeModel newModel) voidsetOrientation(int orientation) voidsetPaintLabels(boolean b) voidsetPaintTicks(boolean b) voidsetPaintTrack(boolean b) voidsetSnapToTicks(boolean b) voidvoidsetValue(int n) voidsetValueIsAdjusting(boolean b) protected voidJDK walks labelTable and calls updateUI on each JComponent value.voidupdateUI()Methods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, addSlotChild, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, fireHierarchyEvent, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, peerContentElement, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeSlotChild, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, applyBackgroundToPeer, applyVisibleToPeer, awtListeners, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, defaultFillCssClass, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, fireComponentEvent, 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, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isThemeDefault, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, peerIs, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, 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, setMixingCutoutShape, setName, setSize, setSize, show, show, size, suppressMouseBridge, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, withPeer, withPeerOnLiveUI
-
Field Details
-
changeListener
The listenercreateChangeListener()produced, subscribed to the model throughmodelRelay. Protected and named as the JDK's is, so a subclass that reads or replaces it compiles unchanged. -
sliderModel
-
majorTickSpacing
protected int majorTickSpacing -
minorTickSpacing
protected int minorTickSpacing -
snapToTicks
protected boolean snapToTicks -
orientation
protected int orientation -
changeEvent
Lazily created byfireStateChanged(), as in the JDK.
-
-
Constructor Details
-
JSlider
public JSlider() -
JSlider
public JSlider(int orientation) -
JSlider
public JSlider(int min, int max) -
JSlider
public JSlider(int min, int max, int value) -
JSlider
public JSlider(int orientation, int min, int max, int value) - Throws:
IllegalArgumentException- iforientationis neitherHORIZONTALnorVERTICAL, or ifmin <= value <= maxdoes not hold — the model's own check
-
JSlider
-
-
Method Details
-
reconcileFields
public final void reconcileFields()D_field_write_reconcile repair hook — compares each JDK-shaped protected field against what was last pushed to the peer and re-pushes on mismatch, logging the ERROR. Final: the reconcile is framework plumbing, not a JDK hook a subclass should retarget.- Specified by:
reconcileFieldsin interfaceFieldReconciler.Reconcilable
-
getValue
public int getValue() -
setValue
public void setValue(int n) -
getMinimum
public int getMinimum() -
setMinimum
public void setMinimum(int minimum) -
getMaximum
public int getMaximum() -
setMaximum
public void setMaximum(int maximum) -
getExtent
public int getExtent() -
setExtent
public void setExtent(int extent) -
getValueIsAdjusting
public boolean getValueIsAdjusting() -
setValueIsAdjusting
public void setValueIsAdjusting(boolean b) -
getModel
-
setModel
-
getOrientation
public int getOrientation() -
setOrientation
public void setOrientation(int orientation) -
getInverted
public boolean getInverted() -
setInverted
public void setInverted(boolean b) -
getPaintTicks
public boolean getPaintTicks() -
setPaintTicks
public void setPaintTicks(boolean b) -
getPaintTrack
public boolean getPaintTrack() -
setPaintTrack
public void setPaintTrack(boolean b) -
getPaintLabels
public boolean getPaintLabels() -
setPaintLabels
public void setPaintLabels(boolean b) -
getSnapToTicks
public boolean getSnapToTicks() -
setSnapToTicks
public void setSnapToTicks(boolean b) -
getMajorTickSpacing
public int getMajorTickSpacing() -
setMajorTickSpacing
public void setMajorTickSpacing(int n) -
getMinorTickSpacing
public int getMinorTickSpacing() -
setMinorTickSpacing
public void setMinorTickSpacing(int n) -
getLabelTable
-
setLabelTable
-
createStandardLabels
Logs the rendering deferral WARN and returns an empty table, since tick labels do not render (SD_sjslider). An empty table satisfies the JDK'sHashtable<Integer, JComponent>value type trivially. -
createStandardLabels
Two-argument form ofcreateStandardLabels(int), with the same deferral. -
updateLabelUIs
protected void updateLabelUIs()JDK walks labelTable and calls updateUI on each JComponent value. Our labelTable is always empty (setLabelTable is deferred at the surrogate layer), so the walk has nothing to do. -
addChangeListener
-
removeChangeListener
-
getChangeListeners
-
fireStateChanged
protected void fireStateChanged() -
createChangeListener
JDK hook: the listener subscribed to the model, which re-fires as this slider. -
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getUIClassID
- Overrides:
getUIClassIDin classJComponent
-
getUI
- Overrides:
getUIin classJComponent
-
setUI
-
setFont
- Overrides:
setFontin classJComponent
-
imageUpdate
- Specified by:
imageUpdatein interfaceImageObserver- Overrides:
imageUpdatein classComponent
-
paramString
- Overrides:
paramStringin classJComponent
-
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classComponent
-