public class AdjustmentSynchronizer extends java.lang.Object implements java.awt.event.AdjustmentListener
Adjustable
s.
Whenever the adjustment of one of the registered Adjustables is updated
the adjustment of the other registered Adjustables is adjusted too.Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.awt.Adjustable,java.lang.Boolean> |
enabledMap |
private java.util.Observable |
observable |
private java.util.Set<java.awt.Adjustable> |
synchronizedAdjustables |
Constructor and Description |
---|
AdjustmentSynchronizer()
Constructs a new
AdjustmentSynchronizer |
Modifier and Type | Method and Description |
---|---|
void |
adapt(javax.swing.JCheckBox view,
java.awt.Adjustable adjustable)
Wires a
JCheckBox to the adjustment synchronizer, in such a way that:
state changes in the checkbox control whether the adjustable participates
in synchronized adjustment
state changes in this AdjustmentSynchronizer are reflected in the
JCheckBox
|
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Event handler for
AdjustmentEvent s |
protected boolean |
isParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable)
Returns true if an adjustable is participating in synchronized scrolling
|
void |
participateInSynchronizedScrolling(java.awt.Adjustable adjustable)
Registers an
Adjustable for participation in synchronized scrolling. |
protected void |
setParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable,
boolean isParticipating)
Sets whether
adjustable participates in adjustment synchronization or not |
private final java.util.Set<java.awt.Adjustable> synchronizedAdjustables
private final java.util.Map<java.awt.Adjustable,java.lang.Boolean> enabledMap
private final java.util.Observable observable
public AdjustmentSynchronizer()
AdjustmentSynchronizer
public void participateInSynchronizedScrolling(java.awt.Adjustable adjustable)
Adjustable
for participation in synchronized scrolling.adjustable
- the adjustablepublic void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
AdjustmentEvent
sadjustmentValueChanged
in interface java.awt.event.AdjustmentListener
protected void setParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable, boolean isParticipating)
adjustable
participates in adjustment synchronization or notadjustable
- the adjustableisParticipating
- true
if adjustable
participates in adjustment synchronizationprotected boolean isParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable)
adjustable
- the adjustablejava.lang.IllegalStateException
- if adjustable is not registered for synchronized scrollingpublic void adapt(javax.swing.JCheckBox view, java.awt.Adjustable adjustable)
JCheckBox
to the adjustment synchronizer, in such a way that:
AdjustmentSynchronizer
are reflected in the
JCheckBox
view
- the checkbox to control whether an adjustable participates in synchronized adjustmentadjustable
- the adjustablejava.lang.IllegalArgumentException
- if view is nulljava.lang.IllegalArgumentException
- if adjustable is null