Java Code Examples for java.awt.event.AdjustmentEvent#TRACK
The following examples show how to use
java.awt.event.AdjustmentEvent#TRACK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JScrollBar.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 2
Source File: ScrollPaneAdjustable.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 3
Source File: ScrollPaneAdjustable.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 4
Source File: ScrollPaneAdjustable.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 5
Source File: JScrollBar.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 6
Source File: JScrollBar.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 7
Source File: JScrollBar.java From JDKSourceCode1.8 with MIT License | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 8
Source File: ScrollPaneAdjustable.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 9
Source File: ScrollPaneAdjustable.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 10
Source File: JScrollBar.java From Java8CN with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 11
Source File: JScrollBar.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 12
Source File: ScrollPaneAdjustable.java From Java8CN with Apache License 2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 13
Source File: JScrollBar.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); if (obj instanceof BoundedRangeModel) { int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED; int type = AdjustmentEvent.TRACK; BoundedRangeModel model = (BoundedRangeModel)obj; int value = model.getValue(); boolean isAdjusting = model.getValueIsAdjusting(); fireAdjustmentValueChanged(id, type, value, isAdjusting); } }
Example 14
Source File: ScrollPaneAdjustable.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Sets the {@code valueIsAdjusting} property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 15
Source File: ScrollPaneAdjustable.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Sets the <code>valueIsAdjusting</code> property. * * @param b new adjustment-in-progress status * @see #getValueIsAdjusting * @since 1.4 */ public void setValueIsAdjusting(boolean b) { if (isAdjusting != b) { isAdjusting = b; AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b); adjustmentListener.adjustmentValueChanged(e); } }
Example 16
Source File: SampleAnalysisWorkflowManagerLAICPMS.java From ET_Redux with Apache License 2.0 | 4 votes |
public void adjustmentValueChanged(AdjustmentEvent evt) { Adjustable source = evt.getAdjustable(); // getValueIsAdjusting() returns true if the user is currently // dragging the scrollbar's knob and has not picked a final value if (evt.getValueIsAdjusting()) { // The user is dragging the knob return; } else { ((javax.swing.JScrollBar) source).getParent().repaint(); } // Determine which scrollbar fired the event int orient = source.getOrientation(); if (orient == Adjustable.HORIZONTAL) { // Event from horizontal scrollbar } else { // Event from vertical scrollbar } // Determine the type of event int type = evt.getAdjustmentType(); switch (type) { case AdjustmentEvent.UNIT_INCREMENT: // Scrollbar was increased by one unit break; case AdjustmentEvent.UNIT_DECREMENT: // Scrollbar was decreased by one unit break; case AdjustmentEvent.BLOCK_INCREMENT: // Scrollbar was increased by one block break; case AdjustmentEvent.BLOCK_DECREMENT: // Scrollbar was decreased by one block break; case AdjustmentEvent.TRACK: // The knob on the scrollbar was dragged break; } // Get current value //int value = evt.getValue(); }
Example 17
Source File: WScrollPanePeer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void run() { if (getScrollChild() == null) { return; } ScrollPane sp = (ScrollPane)WScrollPanePeer.this.target; ScrollPaneAdjustable adj = null; // ScrollPaneAdjustable made public in 1.4, but // get[HV]Adjustable can't be declared to return // ScrollPaneAdjustable because it would break backward // compatibility -- hence the cast if (orient == Adjustable.VERTICAL) { adj = (ScrollPaneAdjustable)sp.getVAdjustable(); } else if (orient == Adjustable.HORIZONTAL) { adj = (ScrollPaneAdjustable)sp.getHAdjustable(); } else { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown orient"); } } if (adj == null) { return; } int newpos = adj.getValue(); switch (type) { case AdjustmentEvent.UNIT_DECREMENT: newpos -= adj.getUnitIncrement(); break; case AdjustmentEvent.UNIT_INCREMENT: newpos += adj.getUnitIncrement(); break; case AdjustmentEvent.BLOCK_DECREMENT: newpos -= adj.getBlockIncrement(); break; case AdjustmentEvent.BLOCK_INCREMENT: newpos += adj.getBlockIncrement(); break; case AdjustmentEvent.TRACK: newpos = this.pos; break; default: if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown type"); } return; } // keep scroll position in acceptable range newpos = Math.max(adj.getMinimum(), newpos); newpos = Math.min(adj.getMaximum(), newpos); // set value, this will synchronously fire an AdjustmentEvent adj.setValueIsAdjusting(isAdjusting); // Fix for 4075484 - consider type information when creating AdjustmentEvent // We can't just call adj.setValue() because it creates AdjustmentEvent with type=TRACK // Instead, we call private method setTypedValue of ScrollPaneAdjustable. AWTAccessor.getScrollPaneAdjustableAccessor().setTypedValue(adj, newpos, type); // Paint the exposed area right away. To do this - find // the heavyweight ancestor of the scroll child. Component hwAncestor = getScrollChild(); while (hwAncestor != null && !(hwAncestor.getPeer() instanceof WComponentPeer)) { hwAncestor = hwAncestor.getParent(); } if (log.isLoggable(PlatformLogger.Level.FINE)) { if (hwAncestor == null) { log.fine("Assertion (hwAncestor != null) failed, " + "couldn't find heavyweight ancestor of scroll pane child"); } } WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); hwPeer.paintDamagedAreaImmediately(); }
Example 18
Source File: WScrollPanePeer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void run() { if (getScrollChild() == null) { return; } ScrollPane sp = (ScrollPane)WScrollPanePeer.this.target; ScrollPaneAdjustable adj = null; // ScrollPaneAdjustable made public in 1.4, but // get[HV]Adjustable can't be declared to return // ScrollPaneAdjustable because it would break backward // compatibility -- hence the cast if (orient == Adjustable.VERTICAL) { adj = (ScrollPaneAdjustable)sp.getVAdjustable(); } else if (orient == Adjustable.HORIZONTAL) { adj = (ScrollPaneAdjustable)sp.getHAdjustable(); } else { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown orient"); } } if (adj == null) { return; } int newpos = adj.getValue(); switch (type) { case AdjustmentEvent.UNIT_DECREMENT: newpos -= adj.getUnitIncrement(); break; case AdjustmentEvent.UNIT_INCREMENT: newpos += adj.getUnitIncrement(); break; case AdjustmentEvent.BLOCK_DECREMENT: newpos -= adj.getBlockIncrement(); break; case AdjustmentEvent.BLOCK_INCREMENT: newpos += adj.getBlockIncrement(); break; case AdjustmentEvent.TRACK: newpos = this.pos; break; default: if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown type"); } return; } // keep scroll position in acceptable range newpos = Math.max(adj.getMinimum(), newpos); newpos = Math.min(adj.getMaximum(), newpos); // set value, this will synchronously fire an AdjustmentEvent adj.setValueIsAdjusting(isAdjusting); // Fix for 4075484 - consider type information when creating AdjustmentEvent // We can't just call adj.setValue() because it creates AdjustmentEvent with type=TRACK // Instead, we call private method setTypedValue of ScrollPaneAdjustable. AWTAccessor.getScrollPaneAdjustableAccessor().setTypedValue(adj, newpos, type); // Paint the exposed area right away. To do this - find // the heavyweight ancestor of the scroll child. Component hwAncestor = getScrollChild(); while (hwAncestor != null && !(hwAncestor.getPeer() instanceof WComponentPeer)) { hwAncestor = hwAncestor.getParent(); } if (log.isLoggable(PlatformLogger.Level.FINE)) { if (hwAncestor == null) { log.fine("Assertion (hwAncestor != null) failed, " + "couldn't find heavyweight ancestor of scroll pane child"); } } WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); hwPeer.paintDamagedAreaImmediately(); }
Example 19
Source File: WScrollPanePeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void run() { if (getScrollChild() == null) { return; } ScrollPane sp = (ScrollPane)WScrollPanePeer.this.target; ScrollPaneAdjustable adj = null; // ScrollPaneAdjustable made public in 1.4, but // get[HV]Adjustable can't be declared to return // ScrollPaneAdjustable because it would break backward // compatibility -- hence the cast if (orient == Adjustable.VERTICAL) { adj = (ScrollPaneAdjustable)sp.getVAdjustable(); } else if (orient == Adjustable.HORIZONTAL) { adj = (ScrollPaneAdjustable)sp.getHAdjustable(); } else { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown orient"); } } if (adj == null) { return; } int newpos = adj.getValue(); switch (type) { case AdjustmentEvent.UNIT_DECREMENT: newpos -= adj.getUnitIncrement(); break; case AdjustmentEvent.UNIT_INCREMENT: newpos += adj.getUnitIncrement(); break; case AdjustmentEvent.BLOCK_DECREMENT: newpos -= adj.getBlockIncrement(); break; case AdjustmentEvent.BLOCK_INCREMENT: newpos += adj.getBlockIncrement(); break; case AdjustmentEvent.TRACK: newpos = this.pos; break; default: if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown type"); } return; } // keep scroll position in acceptable range newpos = Math.max(adj.getMinimum(), newpos); newpos = Math.min(adj.getMaximum(), newpos); // set value, this will synchronously fire an AdjustmentEvent adj.setValueIsAdjusting(isAdjusting); // Fix for 4075484 - consider type information when creating AdjustmentEvent // We can't just call adj.setValue() because it creates AdjustmentEvent with type=TRACK // Instead, we call private method setTypedValue of ScrollPaneAdjustable. AWTAccessor.getScrollPaneAdjustableAccessor().setTypedValue(adj, newpos, type); // Paint the exposed area right away. To do this - find // the heavyweight ancestor of the scroll child. Component hwAncestor = getScrollChild(); while (hwAncestor != null && !(hwAncestor.getPeer() instanceof WComponentPeer)) { hwAncestor = hwAncestor.getParent(); } if (log.isLoggable(PlatformLogger.Level.FINE)) { if (hwAncestor == null) { log.fine("Assertion (hwAncestor != null) failed, " + "couldn't find heavyweight ancestor of scroll pane child"); } } WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); hwPeer.paintDamagedAreaImmediately(); }
Example 20
Source File: WScrollPanePeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void run() { if (getScrollChild() == null) { return; } ScrollPane sp = (ScrollPane)WScrollPanePeer.this.target; ScrollPaneAdjustable adj = null; // ScrollPaneAdjustable made public in 1.4, but // get[HV]Adjustable can't be declared to return // ScrollPaneAdjustable because it would break backward // compatibility -- hence the cast if (orient == Adjustable.VERTICAL) { adj = (ScrollPaneAdjustable)sp.getVAdjustable(); } else if (orient == Adjustable.HORIZONTAL) { adj = (ScrollPaneAdjustable)sp.getHAdjustable(); } else { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown orient"); } } if (adj == null) { return; } int newpos = adj.getValue(); switch (type) { case AdjustmentEvent.UNIT_DECREMENT: newpos -= adj.getUnitIncrement(); break; case AdjustmentEvent.UNIT_INCREMENT: newpos += adj.getUnitIncrement(); break; case AdjustmentEvent.BLOCK_DECREMENT: newpos -= adj.getBlockIncrement(); break; case AdjustmentEvent.BLOCK_INCREMENT: newpos += adj.getBlockIncrement(); break; case AdjustmentEvent.TRACK: newpos = this.pos; break; default: if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Assertion failed: unknown type"); } return; } // keep scroll position in acceptable range newpos = Math.max(adj.getMinimum(), newpos); newpos = Math.min(adj.getMaximum(), newpos); // set value, this will synchronously fire an AdjustmentEvent adj.setValueIsAdjusting(isAdjusting); // Fix for 4075484 - consider type information when creating AdjustmentEvent // We can't just call adj.setValue() because it creates AdjustmentEvent with type=TRACK // Instead, we call private method setTypedValue of ScrollPaneAdjustable. AWTAccessor.getScrollPaneAdjustableAccessor().setTypedValue(adj, newpos, type); // Paint the exposed area right away. To do this - find // the heavyweight ancestor of the scroll child. Component hwAncestor = getScrollChild(); while (hwAncestor != null && !(hwAncestor.getPeer() instanceof WComponentPeer)) { hwAncestor = hwAncestor.getParent(); } if (log.isLoggable(PlatformLogger.Level.FINE)) { if (hwAncestor == null) { log.fine("Assertion (hwAncestor != null) failed, " + "couldn't find heavyweight ancestor of scroll pane child"); } } WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); hwPeer.paintDamagedAreaImmediately(); }