Java Code Examples for java.awt.event.AdjustmentEvent#getValueIsAdjusting()

The following examples show how to use java.awt.event.AdjustmentEvent#getValueIsAdjusting() . 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: InteractiveDoG.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
@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 );
	}
}
 
Example 2
Source File: InteractiveIntegral.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
@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 );
	}
}
 
Example 3
Source File: InteractiveCanvasComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent e) {
    if (internalChange) return;

    boolean valueAdjusting = e.getValueIsAdjusting();
    boolean offsetAdjusting;

    if (horizontal) {
        offsetAdjusting = isHOffsetAdjusting();
        if (valueAdjusting && !offsetAdjusting) hOffsetAdjustingStarted();
        setOffset(getValue(), getOffsetY());
    } else {
        offsetAdjusting = isVOffsetAdjusting();
        if (valueAdjusting && !offsetAdjusting) vOffsetAdjustingStarted();
        setOffset(getOffsetX(), getValue());
    }

    repaintDirtyAccel();
    //            repaintDirty();

    if (!valueAdjusting && offsetAdjusting)
        // Bugfix #165020, process after all pending updates
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                if (horizontal) hOffsetAdjustingFinished();
                else vOffsetAdjustingFinished();
                repaintDirty();
            }
        });
}
 
Example 4
Source File: InteractiveCanvasComponent.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent e) {
    if (internalChange) return;

    boolean valueAdjusting = e.getValueIsAdjusting();
    boolean offsetAdjusting;

    if (horizontal) {
        offsetAdjusting = isHOffsetAdjusting();
        if (valueAdjusting && !offsetAdjusting) hOffsetAdjustingStarted();
        setOffset(getValue(), getOffsetY());
    } else {
        offsetAdjusting = isVOffsetAdjusting();
        if (valueAdjusting && !offsetAdjusting) vOffsetAdjustingStarted();
        setOffset(getOffsetX(), getValue());
    }

    repaintDirtyAccel();
    //            repaintDirty();

    if (!valueAdjusting && offsetAdjusting)
        // Bugfix #165020, process after all pending updates
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                if (horizontal) hOffsetAdjustingFinished();
                else vOffsetAdjustingFinished();
                repaintDirty();
            }
        });
}
 
Example 5
Source File: InteractiveDoG.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void adjustmentValueChanged( final AdjustmentEvent event )
{
	if ( enableSigma2 )
	{
		sigma2 = computeValueFromScrollbarPosition( event.getValue(), min, max, scrollbarSize );
		
		if ( sigma2 < sigma )
		{
			sigma2 = sigma + 0.001f;
			sigmaScrollbar2.setValue( computeScrollbarPositionFromValue( sigma2, min, max, scrollbarSize ) );
		}
		
		sigma2Label.setText( "Sigma 2 = " + sigma2 );
		
		if ( !event.getValueIsAdjusting() )
		{
			while ( isComputing )
			{
				SimpleMultiThreading.threadWait( 10 );
			}
			updatePreview( ValueChange.SIGMA );
		}
		
	}
	else
	{
		// if no manual adjustment simply reset it
		sigmaScrollbar2.setValue( computeScrollbarPositionFromValue( sigma2, min, max, scrollbarSize ) );
	}
}
 
Example 6
Source File: InteractiveIntegral.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void adjustmentValueChanged( final AdjustmentEvent event )
{
	if ( enableRadius2 )
	{
		radius2 = Math.round( computeValueFromScrollbarPosition( event.getValue(), min, max, scrollbarSize ) );
						
		if ( radius2 <= radius1 )
		{
			radius2 = radius1 + 1;
			radiusScrollbar2.setValue( computeScrollbarPositionFromValue( radius2, min, max, scrollbarSize ) );
		}
		
		radius2Label.setText( "Radius 2 = " + radius2 );
		
		if ( !event.getValueIsAdjusting() )
		{
			while ( isComputing )
			{
				SimpleMultiThreading.threadWait( 10 );
			}
			updatePreview( ValueChange.RADIUS );
		}
		
	}
	else
	{
		// if no manual adjustment simply reset it
		radiusScrollbar2.setValue( computeScrollbarPositionFromValue( radius2, min, max, scrollbarSize ) );
	}
}
 
Example 7
Source File: InteractiveIntegral.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@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 );
	}
}
 
Example 8
Source File: TiledImageViewerContainer.java    From WorldPainter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
    if (programmaticChange) {
        return;
    }
    programmaticChange = true;
    try {
        if (e.getSource() == horizontalScrollbar) {
            int dx = e.getValue() - previousHorizontalValue;
            if (dx != 0) {
                previousHorizontalValue = e.getValue();
                view.moveBy(dx, 0);
                if (! e.getValueIsAdjusting()) {
                    updateScrollBars();
                }
            }
        } else if (e.getSource() == verticalScrollbar) {
            int dy = e.getValue() - previousVerticalValue;
            if (dy != 0) {
                previousVerticalValue = e.getValue();
                view.moveBy(0, dy);
                if (! e.getValueIsAdjusting()) {
                    updateScrollBars();
                }
            }
        }
    } finally {
        programmaticChange = false;
    }
}
 
Example 9
Source File: SampleAnalysisWorkflowManagerIDTIMS.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
@Override
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 10
Source File: SampleAnalysisWorkflowManagerLAICPMS.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
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();
}