类java.awt.event.AdjustmentEvent源码实例Demo

下面列出了怎么用java.awt.event.AdjustmentEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: rapidminer-studio   文件: EULADialog.java
/**
 * Listens to changes of the scroll bar of the text are showing the EULA text, enables the check
 * box once the user scrolled to the end of the document.
 */
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
	JScrollBar scrollBar = this.scrollPane.getVerticalScrollBar();
	if (e.getSource() == scrollBar) {
		// the maximum value of the scroll bar assumes that the content is
		// not visible anymore, since this is not the case when scrolling
		// to the end of the document (the last part is still visible),
		// we have to include the visible amount in the comparison
		int currentValue = scrollBar.getValue() + scrollBar.getVisibleAmount();
		if (currentValue >= scrollBar.getMaximum()) {
			// the user scrolled to the end of the document
			this.acceptCheckBox.setEnabled(true);
			this.acceptCheckBox.requestFocusInWindow();
		}
	}
}
 
源代码2 项目: jdk8u-dev-jdk   文件: ListHelper.java
void trackMouseDraggedScroll(int mouseX, int mouseY, int listWidth, int listHeight){

        if (!mouseDraggedOutVertically){
            if (vsb.beforeThumb(mouseX, mouseY)) {
                vsb.setMode(AdjustmentEvent.UNIT_DECREMENT);
            } else {
                vsb.setMode(AdjustmentEvent.UNIT_INCREMENT);
            }
        }

        if(!mouseDraggedOutVertically && (mouseY < 0 || mouseY >= listHeight)){
            mouseDraggedOutVertically = true;
            vsb.startScrollingInstance();
        }

        if (mouseDraggedOutVertically && mouseY >= 0 && mouseY < listHeight && mouseX >= 0 && mouseX < listWidth){
            mouseDraggedOutVertically = false;
            vsb.stopScrollingInstance();
        }
    }
 
源代码3 项目: hottub   文件: ScrollPaneAdjustable.java
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occurred
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
源代码4 项目: openjdk-jdk8u   文件: ListHelper.java
void trackMouseDraggedScroll(int mouseX, int mouseY, int listWidth, int listHeight){

        if (!mouseDraggedOutVertically){
            if (vsb.beforeThumb(mouseX, mouseY)) {
                vsb.setMode(AdjustmentEvent.UNIT_DECREMENT);
            } else {
                vsb.setMode(AdjustmentEvent.UNIT_INCREMENT);
            }
        }

        if(!mouseDraggedOutVertically && (mouseY < 0 || mouseY >= listHeight)){
            mouseDraggedOutVertically = true;
            vsb.startScrollingInstance();
        }

        if (mouseDraggedOutVertically && mouseY >= 0 && mouseY < listHeight && mouseX >= 0 && mouseX < listWidth){
            mouseDraggedOutVertically = false;
            vsb.stopScrollingInstance();
        }
    }
 
源代码5 项目: openjdk-jdk9   文件: ListHelper.java
void trackMouseDraggedScroll(int mouseX, int mouseY, int listWidth, int listHeight){

        if (!mouseDraggedOutVertically){
            if (vsb.beforeThumb(mouseX, mouseY)) {
                vsb.setMode(AdjustmentEvent.UNIT_DECREMENT);
            } else {
                vsb.setMode(AdjustmentEvent.UNIT_INCREMENT);
            }
        }

        if(!mouseDraggedOutVertically && (mouseY < 0 || mouseY >= listHeight)){
            mouseDraggedOutVertically = true;
            vsb.startScrollingInstance();
        }

        if (mouseDraggedOutVertically && mouseY >= 0 && mouseY < listHeight && mouseX >= 0 && mouseX < listWidth){
            mouseDraggedOutVertically = false;
            vsb.stopScrollingInstance();
        }
    }
 
源代码6 项目: jdk-1.7-annotated   文件: ScrollPaneAdjustable.java
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occured
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
源代码7 项目: SPIM_Registration   文件: InteractiveIntegral.java
@Override
public void adjustmentValueChanged( final AdjustmentEvent event )
{			
	threshold = min + ( (log1001 - (float)Math.log10(1001-event.getValue()))/log1001 ) * (max-min);
	label.setText( "Threshold = " + threshold );

	if ( !isComputing )
	{
		updatePreview( ValueChange.THRESHOLD );
	}
	else if ( !event.getValueIsAdjusting() )
	{
		while ( isComputing )
		{
			SimpleMultiThreading.threadWait( 10 );
		}
		updatePreview( ValueChange.THRESHOLD );
	}
}
 
源代码8 项目: hottub   文件: ListHelper.java
void trackMouseDraggedScroll(int mouseX, int mouseY, int listWidth, int listHeight){

        if (!mouseDraggedOutVertically){
            if (vsb.beforeThumb(mouseX, mouseY)) {
                vsb.setMode(AdjustmentEvent.UNIT_DECREMENT);
            } else {
                vsb.setMode(AdjustmentEvent.UNIT_INCREMENT);
            }
        }

        if(!mouseDraggedOutVertically && (mouseY < 0 || mouseY >= listHeight)){
            mouseDraggedOutVertically = true;
            vsb.startScrollingInstance();
        }

        if (mouseDraggedOutVertically && mouseY >= 0 && mouseY < listHeight && mouseX >= 0 && mouseX < listWidth){
            mouseDraggedOutVertically = false;
            vsb.stopScrollingInstance();
        }
    }
 
源代码9 项目: jdk8u60   文件: ScrollPaneAdjustable.java
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occurred
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
源代码10 项目: openjdk-8   文件: ListHelper.java
void trackMouseDraggedScroll(int mouseX, int mouseY, int listWidth, int listHeight){

        if (!mouseDraggedOutVertically){
            if (vsb.beforeThumb(mouseX, mouseY)) {
                vsb.setMode(AdjustmentEvent.UNIT_DECREMENT);
            } else {
                vsb.setMode(AdjustmentEvent.UNIT_INCREMENT);
            }
        }

        if(!mouseDraggedOutVertically && (mouseY < 0 || mouseY >= listHeight)){
            mouseDraggedOutVertically = true;
            vsb.startScrollingInstance();
        }

        if (mouseDraggedOutVertically && mouseY >= 0 && mouseY < listHeight && mouseX >= 0 && mouseX < listWidth){
            mouseDraggedOutVertically = false;
            vsb.stopScrollingInstance();
        }
    }
 
源代码11 项目: jdk8u60   文件: ListHelper.java
void trackMouseDraggedScroll(int mouseX, int mouseY, int listWidth, int listHeight){

        if (!mouseDraggedOutVertically){
            if (vsb.beforeThumb(mouseX, mouseY)) {
                vsb.setMode(AdjustmentEvent.UNIT_DECREMENT);
            } else {
                vsb.setMode(AdjustmentEvent.UNIT_INCREMENT);
            }
        }

        if(!mouseDraggedOutVertically && (mouseY < 0 || mouseY >= listHeight)){
            mouseDraggedOutVertically = true;
            vsb.startScrollingInstance();
        }

        if (mouseDraggedOutVertically && mouseY >= 0 && mouseY < listHeight && mouseX >= 0 && mouseX < listWidth){
            mouseDraggedOutVertically = false;
            vsb.stopScrollingInstance();
        }
    }
 
源代码12 项目: SPIM_Registration   文件: InteractiveDoG.java
@Override
public void adjustmentValueChanged( final AdjustmentEvent event )
{			
	threshold = min + ( (log1001 - (float)Math.log10(1001-event.getValue()))/log1001 ) * (max-min);
	label.setText( "Threshold = " + threshold );

	if ( !isComputing )
	{
		updatePreview( ValueChange.THRESHOLD );
	}
	else if ( !event.getValueIsAdjusting() )
	{
		while ( isComputing )
		{
			SimpleMultiThreading.threadWait( 10 );
		}
		updatePreview( ValueChange.THRESHOLD );
	}
}
 
源代码13 项目: rapidminer-studio   文件: JEditTextArea.java
@Override
public void adjustmentValueChanged(final AdjustmentEvent evt) {
	if (!scrollBarsInitialized) {
		return;
	}

	// If this is not done, mousePressed events accumilate
	// and the result is that scrolling doesn't stop after
	// the mouse is released
	SwingUtilities.invokeLater(new Runnable() {

		@Override
		public void run() {
			if (evt.getAdjustable() == vertical) {
				setFirstLine(vertical.getValue());
			} else {
				setHorizontalOffset(-horizontal.getValue());
			}
		}
	});
}
 
源代码14 项目: openjdk-jdk8u   文件: WScrollbarPeer.java
void dragEnd(final int value) {
    final Scrollbar sb = (Scrollbar)target;

    if (!dragInProgress) {
        return;
    }

    dragInProgress = false;
    WToolkit.executeOnEventHandlerThread(sb, new Runnable() {
        public void run() {
            // NB: notification only, no sb.setValue()
            // last TRACK event will have done it already
            sb.setValueIsAdjusting(false);
            postEvent(new AdjustmentEvent(sb,
                            AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                            AdjustmentEvent.TRACK, value, false));
        }
    });
}
 
源代码15 项目: jdk8u-jdk   文件: JScrollBar.java
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);
    }
}
 
源代码16 项目: jdk1.8-source-analysis   文件: JScrollBar.java
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);
    }
}
 
源代码17 项目: rapidminer-studio   文件: ProcessPanelScroller.java
/**
 * Creates a handler for scrolling for the view and its surrounding scrollPane.
 *
 * @param view
 *            the {@link ProcessRendererView}
 * @param scrollPane
 *            the {@link JScrollPane} containing the view
 */
ProcessPanelScroller(final ProcessRendererView view, final JScrollPane scrollPane) {
	this.scrollPane = scrollPane;
	this.rendererView = view;
	rendererView.addMouseWheelListener(wheelListener);

	// add listener to check for size changes of the scrollbar
	scrollPane.getHorizontalScrollBar().addAdjustmentListener(new AdjustmentListener() {

		private int lastValue;

		@Override
		public void adjustmentValueChanged(AdjustmentEvent e) {
			if (lastValue == scrollPane.getHorizontalScrollBar().getMaximum()) {
				return;
			}
			// the maximum value changed, so the process canvas size changed
			lastValue = scrollPane.getHorizontalScrollBar().getMaximum();
			if (zoomed) {
				// set the scrollbar values needed for centered zoom if needed
				if (scrollPane.getHorizontalScrollBar().getValue() != desiredHorizontalScrollValue) {
					scrollPane.getHorizontalScrollBar().setValue(desiredHorizontalScrollValue);
				}
				if (scrollPane.getVerticalScrollBar().getValue() != desiredVerticalScrollValue) {
					scrollPane.getVerticalScrollBar().setValue(desiredVerticalScrollValue);
				}
				zoomed = false;
			}
		}
	});
}
 
源代码18 项目: MeteoInfo   文件: LegendView.java
private void initComponents() {
    this.setPreferredSize(new Dimension(100, 200));
    this.setLayout(new BorderLayout());
    this.setBackground(Color.white);

    _vScrollBar = new JScrollBar(JScrollBar.VERTICAL);        
    _vScrollBar.addAdjustmentListener(new AdjustmentListener() {
        @Override
        public void adjustmentValueChanged(AdjustmentEvent e) {
            onScrollValueChanged(e);
        }
    });
    this.add(_vScrollBar, BorderLayout.EAST);
    this._vScrollBar.setSize(20, this.getHeight());
    this._vScrollBar.setLocation(this.getWidth() - this._vScrollBar.getWidth(), 0);        

    _textField = new JTextField();
    _textField.setVisible(false);
    this.add(_textField);

    _frmPointSymbolSet = null;
    _frmPolylineSymbolSet = null;
    _frmPolygonSymbolSet = null;
    _frmColorSymbolSet = null;
    _legendScheme = null;
    _breakHeight = 20;
    _symbolWidth = 60;
    _valueWidth = (this.getWidth() - _symbolWidth) / 2;
    _labelWidth = _valueWidth;
}
 
源代码19 项目: SPIM_Registration   文件: InteractiveIntegral.java
@Override
public void adjustmentValueChanged( final AdjustmentEvent event )
{
	radius1 = Math.round( computeValueFromScrollbarPosition( event.getValue(), min, max, scrollbarSize ) );			
	
	if ( !enableRadius2 )
	{
		radius2 = computeRadius2( radius1 );
		radiusText2.setText( "Radius 2 = " + radius2 );			    
		radiusScrollbar2.setValue( computeScrollbarPositionFromValue( radius2, min, max, scrollbarSize ) );
	}
	else if ( radius1 >= radius2 )
	{
		radius1 = radius2 - 2;
		radiusScrollbar1.setValue( computeScrollbarPositionFromValue( radius1, min, max, scrollbarSize ) );
	}
	
	label.setText( "Radius 1 = " + radius1 );
	
	if ( !event.getValueIsAdjusting() )
	{
		while ( isComputing )
		{
			SimpleMultiThreading.threadWait( 10 );
		}
		updatePreview( ValueChange.RADIUS );
	}
}
 
源代码20 项目: openjdk-8-source   文件: JScrollBar.java
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);
    }
}
 
源代码21 项目: 07kit   文件: SmartScroller.java
@Override
public void adjustmentValueChanged(final AdjustmentEvent e) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            checkScrollBar(e);
        }
    });
}
 
源代码22 项目: pdfxtk   文件: HNav.java
public static void main(String[] argv) {
   HNav nav0 = new HNav(200);
   nav0.setMaximum(100);
   nav0.setMinimum(-100);

   HNav nav1 = new HNav(200);
   nav1.setMaximum(0);
   nav1.setMinimum(-100);

   HNav nav2 = new HNav(200);
   nav2.setMaximum(100);
   nav2.setMinimum(0);
   
   AdjustmentListener l = new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
  System.out.println(e);
}
     };
   
   nav0.addAdjustmentListener(l);
   nav1.addAdjustmentListener(l);
   nav2.addAdjustmentListener(l);

   new Frame(nav0, true);
   new Frame(nav1, true);
   new Frame(nav2, true);
 }
 
源代码23 项目: jdk8u-jdk   文件: ScrollPaneAdjustable.java
/**
 * 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);
    }
}
 
源代码24 项目: jdk8u-dev-jdk   文件: WScrollbarPeer.java
private void postAdjustmentEvent(final int type, final int value,
                                 final boolean isAdjusting)
{
    final Scrollbar sb = (Scrollbar)target;
    WToolkit.executeOnEventHandlerThread(sb, new Runnable() {
        public void run() {
            sb.setValueIsAdjusting(isAdjusting);
            sb.setValue(value);
            postEvent(new AdjustmentEvent(sb,
                            AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                            type, value, isAdjusting));
        }
    });
}
 
源代码25 项目: TencentKona-8   文件: LWScrollBarPeer.java
@Override
public void adjustmentValueChanged(final AdjustmentEvent e) {
    final int value = e.getValue();
    synchronized (getDelegateLock()) {
        if (currentValue == value) {
            return;
        }
        currentValue = value;
    }
    getTarget().setValueIsAdjusting(e.getValueIsAdjusting());
    getTarget().setValue(value);
    postEvent(new AdjustmentEvent(getTarget(), e.getID(),
            e.getAdjustmentType(), value,
            e.getValueIsAdjusting()));
}
 
源代码26 项目: openjdk-8-source   文件: ScrollPaneAdjustable.java
/**
 * 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);
    }
}
 
源代码27 项目: TencentKona-8   文件: WScrollbarPeer.java
private void postAdjustmentEvent(final int type, final int value,
                                 final boolean isAdjusting)
{
    final Scrollbar sb = (Scrollbar)target;
    WToolkit.executeOnEventHandlerThread(sb, new Runnable() {
        public void run() {
            sb.setValueIsAdjusting(isAdjusting);
            sb.setValue(value);
            postEvent(new AdjustmentEvent(sb,
                            AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                            type, value, isAdjusting));
        }
    });
}
 
源代码28 项目: Bytecoder   文件: JScrollBar.java
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);
    }
}
 
/**
 * 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);
    }
}
 
源代码30 项目: hottub   文件: ScrollPaneAdjustable.java
/**
 * 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);
    }
}