Java Code Examples for java.awt.event.AdjustmentEvent

The following are top voted examples for showing how to use java.awt.event.AdjustmentEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: PointOfSale   File: Cart.java   View source code 7 votes vote down vote up
public JScrollPane generateScrollPane()
{	
	JScrollPane newScroll = new JScrollPane();
	JList list = new JList(listModel);
	list.setFont( new Font("monospaced", Font.PLAIN, 12) );
	newScroll.setViewportView(list);
	
	Dimension listSize = new Dimension(400, 150);
	newScroll.setSize(listSize);
	newScroll.setMaximumSize(listSize);
	newScroll.setPreferredSize(listSize);
	
	newScroll.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {  
        public void adjustmentValueChanged(AdjustmentEvent e) {  
            e.getAdjustable().setValue(e.getAdjustable().getMaximum());  
        }
    }); 
	return newScroll;
}
 
Example 2
Project: rapidminer   File: EULADialog.java   View source code 6 votes vote down vote up
/**
 * 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();
		}
	}
}
 
Example 3
Project: rapidminer   File: JEditTextArea.java   View source code 6 votes vote down vote up
@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());
			}
		}
	});
}
 
Example 4
Project: OpenJSharp   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 5
Project: OpenJSharp   File: WScrollbarPeer.java   View source code 6 votes vote down vote up
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));
        }
    });
}
 
Example 6
Project: OpenJSharp   File: ListHelper.java   View source code 6 votes vote down vote up
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();
        }
    }
 
Example 7
Project: JuggleMasterPro   File: SpeedJScrollBar.java   View source code 6 votes vote down vote up
/**
 * Method description
 * 
 * @see
 * @param objPadjustmentEvent
 */
@Override final public void adjustmentValueChanged(AdjustmentEvent objPadjustmentEvent) {

	final byte bytLpreviousValue = this.objGcontrolJFrame.getControlValue(Constants.bytS_BYTE_LOCAL_SPEED);
	final byte bytLcurrentValue = (byte) objPadjustmentEvent.getValue();
	if (bytLcurrentValue != bytLpreviousValue) {
		this.objGcontrolJFrame.saveControlValue(Constants.bytS_BYTE_LOCAL_SPEED, bytLcurrentValue);

		// TODO : si pas de doRestartJuggling
		// this.objGcontrolJFrame.setSpeedControls();
		// this.objGcontrolJFrame.doAddAction(Constants.intS_ACTION_INIT_TITLES | Constants.intS_ACTION_INIT_ANIMATION_PROPERTIES);

		Tools.debug("SpeedJScrollBar.adjustmentValueChanged(): ControlJFrame.doRestartJuggling()");
		this.objGcontrolJFrame.doRestartJuggling();
	}
}
 
Example 8
Project: JuggleMasterPro   File: StrobeJScrollBar.java   View source code 6 votes vote down vote up
/**
 * Method description
 * 
 * @see
 * @param objPadjustmentEvent
 */
@Override final public void adjustmentValueChanged(AdjustmentEvent objPadjustmentEvent) {

	Tools.debug("StrobeJScrollBar.adjustmentValueChanged()");
	final byte bytLcurrentValue = (byte) objPadjustmentEvent.getValue();
	final byte bytLpreviousValue = this.objGcontrolJFrame.getControlValue(Constants.bytS_BYTE_LOCAL_STROBE);
	if (bytLcurrentValue != bytLpreviousValue) {
		this.objGcontrolJFrame.saveControlValue(Constants.bytS_BYTE_LOCAL_STROBE, bytLcurrentValue);
		if ((this.objGcontrolJFrame.isControlSelected(Constants.bytS_BOOLEAN_LOCAL_FLASH) || this.objGcontrolJFrame.isControlSelected(Constants.bytS_BOOLEAN_LOCAL_ROBOT))
			&& this.objGcontrolJFrame.isControlSelected(Constants.bytS_BOOLEAN_LOCAL_BALLS)
			&& this.objGcontrolJFrame.getControlValue(Constants.bytS_BYTE_LOCAL_BALLS_TRAIL) == Constants.bytS_BYTE_LOCAL_BALLS_TRAIL_FULL) {
			this.objGcontrolJFrame.doAddAction(Constants.intS_ACTION_INIT_TITLES | Constants.intS_ACTION_CLEAR_ANIMATION_IMAGE
												| Constants.intS_ACTION_RECREATE_JUGGLER_TRAILS_IMAGES
												| Constants.intS_ACTION_RECREATE_BALLS_TRAILS_IMAGES);
		}
		this.objGcontrolJFrame.setStrobeControls();
	}
}
 
Example 9
Project: jdk8u-jdk   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 10
Project: jdk8u-jdk   File: WScrollbarPeer.java   View source code 6 votes vote down vote up
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));
        }
    });
}
 
Example 11
Project: jdk8u-jdk   File: ListHelper.java   View source code 6 votes vote down vote up
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();
        }
    }
 
Example 12
Project: openjdk-jdk10   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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 AdjustmentEvent 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);
    }
}
 
Example 13
Project: openjdk-jdk10   File: ListHelper.java   View source code 6 votes vote down vote up
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();
        }
    }
 
Example 14
Project: openjdk-jdk10   File: WScrollbarPeer.java   View source code 6 votes vote down vote up
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));
        }
    });
}
 
Example 15
Project: geomapapp   File: DSDPDemo.java   View source code 6 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent ae) {
	if ( sp != null && 
			ae.getSource() == sp.getVerticalScrollBar()  &&
			! adjustment && 
			coreDisp != null)	{
		adjustGraphs( coreDisp.getZScale(), 
				coreDisp.getVisibleRect().getCenterY(), 
				"FOSSIL DISPLAY" );
	}
	else if ( sedimentSP != null && 
			ae.getSource() == sedimentSP.getVerticalScrollBar() &&
			!adjustment && 
			sedimentGraph != null) {
		adjustGraphs( sedimentGraph.getZoom(), 
				sedimentGraph.getVisibleRect().getCenterY(), 
				"SEDIMENT GRAPH" );
	}
}
 
Example 16
Project: hy.common.ui   File: JTimePanel.java   View source code 6 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent e)
{
	if ( isAllowEvent )
	{
		if ( e.getValue() == -1 )
		{
			jsHour.setValue(23);
			return;
		}
		else if ( e.getValue() == 24 )
		{
			jsHour.setValue(0);
			return;
		}
		
		setHour(e.getValue());
	}
}
 
Example 17
Project: hy.common.ui   File: JTimePanel.java   View source code 6 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent e)
{
	if ( isAllowEvent )
	{
		if ( e.getValue() == -1 )
		{
			jsMinute.setValue(59);
			return;
		}
		else if ( e.getValue() == 60 )
		{
			jsMinute.setValue(0);
			return;
		}
		
		setMinute(e.getValue());
	}
}
 
Example 18
Project: hy.common.ui   File: JTimePanel.java   View source code 6 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent e)
{
	if ( isAllowEvent )
	{
		if ( e.getValue() == -1 )
		{
			jsSecond.setValue(59);
			return;
		}
		else if ( e.getValue() == 60 )
		{
			jsSecond.setValue(0);
			return;
		}
		
		setSecond(e.getValue());
	}
}
 
Example 19
Project: openjdk9   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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 AdjustmentEvent 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);
    }
}
 
Example 20
Project: openjdk9   File: ListHelper.java   View source code 6 votes vote down vote up
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();
        }
    }
 
Example 21
Project: openjdk9   File: WScrollbarPeer.java   View source code 6 votes vote down vote up
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));
        }
    });
}
 
Example 22
Project: deltahex-java   File: DefaultCodeAreaPainter.java   View source code 6 votes vote down vote up
@Override
        public void adjustmentValueChanged(AdjustmentEvent e) {
            if (horizontalScrollUnit == HorizontalScrollUnit.CHARACTER) {
                scrollPosition.setScrollCharPosition(scrollPanel.getHorizontalScrollBar().getValue());
            } else {
                if (characterWidth > 0) {
                    int horizontalScroll = scrollPanel.getHorizontalScrollBar().getValue();
                    scrollPosition.setScrollCharPosition(horizontalScroll / characterWidth);
                    scrollPosition.setScrollCharOffset(horizontalScroll % characterWidth);
                }
            }

            worker.getCodeArea().repaint();
//            dataViewScrolled(codeArea.getGraphics());
            notifyScrolled();
        }
 
Example 23
Project: Java8CN   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 24
Project: jdk8u_jdk   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 25
Project: jdk8u_jdk   File: WScrollbarPeer.java   View source code 6 votes vote down vote up
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));
        }
    });
}
 
Example 26
Project: jdk8u_jdk   File: ListHelper.java   View source code 6 votes vote down vote up
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();
        }
    }
 
Example 27
Project: lookaside_java-1.8.0-openjdk   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 28
Project: lookaside_java-1.8.0-openjdk   File: WScrollbarPeer.java   View source code 6 votes vote down vote up
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));
        }
    });
}
 
Example 29
Project: lookaside_java-1.8.0-openjdk   File: ListHelper.java   View source code 6 votes vote down vote up
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();
        }
    }
 
Example 30
Project: Net2Plan   File: JScrollPopupMenu.java   View source code 6 votes vote down vote up
private JScrollBar getScrollBar()
{
    if (popupScrollBar == null)
    {
        popupScrollBar = new JScrollBar(JScrollBar.VERTICAL);
        popupScrollBar.addAdjustmentListener(new AdjustmentListener()
        {
            @Override
            public void adjustmentValueChanged(AdjustmentEvent e)
            {
                doLayout();
                repaint();
            }
        });

        popupScrollBar.setVisible(false);
    }

    return popupScrollBar;
}
 
Example 31
Project: SweetHome3D   File: SwingTools.java   View source code 6 votes vote down vote up
/**
 * Returns a scroll bar adjustment listener bound to the given <code>scrollPane</code> view
 * that updates view tool tip when its vertical scroll bar is adjusted.
 */
public static AdjustmentListener createAdjustmentListenerUpdatingScrollPaneViewToolTip(final JScrollPane scrollPane)
{
	return new AdjustmentListener()
	{
		public void adjustmentValueChanged(AdjustmentEvent ev)
		{
			Point screenLocation = MouseInfo.getPointerInfo().getLocation();
			Point point = new Point(screenLocation);
			Component view = scrollPane.getViewport().getView();
			SwingUtilities.convertPointFromScreen(point, view);
			if (scrollPane.isShowing() && scrollPane.getViewport().getViewRect().contains(point))
			{
				MouseEvent mouseEvent = new MouseEvent(view, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0,
						point.x, point.y, 0, false, MouseEvent.NOBUTTON);
				if (isToolTipShowing())
				{
					ToolTipManager.sharedInstance().mouseMoved(mouseEvent);
				}
			}
		}
	};
}
 
Example 32
Project: javify   File: Scrollbar.java   View source code 6 votes vote down vote up
/**
 * Package private method to determine whether to call
 * processEvent() or not.  Will handle events from peer and update
 * the current value.
 */
void dispatchEventImpl(AWTEvent e)
{
  if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST
      && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST)
    {
      AdjustmentEvent ae = (AdjustmentEvent) e;
      boolean adjusting = ae.getValueIsAdjusting();
      if (adjusting)
        setValueIsAdjusting(true);
      try
        {
          setValue(((AdjustmentEvent) e).getValue());
          if (adjustment_listeners != null
              || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)
            processEvent(e);
        }
      finally
        {
          if (adjusting)
            setValueIsAdjusting(false);
        }
    }
  else
    super.dispatchEventImpl(e);
}
 
Example 33
Project: gepard   File: ControlPanel.java   View source code 6 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent evt) {
	try {
		if (!noScrollbarEvents) {
			// get values
			int lv = scrLower.getValue(), uv = scrUpper.getValue(), gv = scrGreyscale.getValue();

			// assure lower value is not higher than upper value
			if (lv >= uv) {
				scrLower.setValue(uv - 1);
				lv = uv - 1;
			}
			// replot
			ctrl.eventReplot(lv / 100f, uv / 100f, gv / 100f);
		}
	} catch (Exception e) {
		e.printStackTrace();
		ClientGlobals.unexpectedError(e, ctrl);
	}

}
 
Example 34
Project: jailer   File: JScrollC2PopupMenu.java   View source code 6 votes vote down vote up
protected JScrollBar getScrollBar() {
	if (popupScrollBar == null) {
		popupScrollBar = new JScrollBar(JScrollBar.VERTICAL);
		popupScrollBar.addAdjustmentListener(new AdjustmentListener() {
			@Override
			public void adjustmentValueChanged(AdjustmentEvent e) {
				doLayout();
				repaint();
			}
		});

		popupScrollBar.setVisible(false);
	}

	return popupScrollBar;
}
 
Example 35
Project: rapidminer-studio   File: EULADialog.java   View source code 6 votes vote down vote up
/**
 * 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();
		}
	}
}
 
Example 36
Project: spicy   File: ScrollPaneAdjustmentListener.java   View source code 6 votes vote down vote up
public void adjustmentValueChanged(AdjustmentEvent e) {
    LayerWidget mainLayer = glassPane.getMainLayer();
    List<Widget> listaWidget = mainLayer.getChildren();
    Iterator iteratore = listaWidget.iterator();
    this.jLayeredPane.moveToFront(this.glassPane);
    while (iteratore.hasNext()) {
        Widget widget = (Widget) iteratore.next();
        ICaratteristicheWidget caratteristicheWidget = (ICaratteristicheWidget) mainLayer.getChildConstraint(widget);
        Point newPoint = null;
        if (caratteristicheWidget.getTreeType().equalsIgnoreCase(Costanti.TREE_SOURCE) || caratteristicheWidget.getTreeType().equalsIgnoreCase(Costanti.TREE_TARGET)) {
            newPoint = findNewLocationForTree(caratteristicheWidget, (JTree) connectedComponent);
        } else if (caratteristicheWidget.getTreeType().equalsIgnoreCase(Costanti.FOREIGN_KEY) || caratteristicheWidget.getTreeType().equalsIgnoreCase(Costanti.KEY)) {

            newPoint = findNewLocationForOther(caratteristicheWidget, widget);
        }
        if (newPoint != null) {
            widget.setPreferredLocation(newPoint);
        }
        glassPane.getScene().validate();
        this.jLayeredPane.moveToFront(this.glassPane);
        glassPane.updateUI();
    }
    glassPane.updateUI();
}
 
Example 37
Project: jvm-stm   File: Scrollbar.java   View source code 6 votes vote down vote up
/**
  * Package private method to determine whether to call
  * processEvent() or not.  Will handle events from peer and update
  * the current value.
  */
 void dispatchEventImpl(AWTEvent e)
 {
   if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST 
&& e.id >= AdjustmentEvent.ADJUSTMENT_FIRST)
     {
AdjustmentEvent ae = (AdjustmentEvent) e;
boolean adjusting = ae.getValueIsAdjusting();
if (adjusting)
  setValueIsAdjusting(true);
try
  {
    setValue(((AdjustmentEvent) e).getValue());
    if (adjustment_listeners != null 
	|| (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)
      processEvent(e);
  }
finally
  {
    if (adjusting)
      setValueIsAdjusting(false);
  }
     }
   else
     super.dispatchEventImpl(e);
 }
 
Example 38
Project: MeteoInfoLib   File: SymbolControl.java   View source code 6 votes vote down vote up
private void initComponents() {
    this.setPreferredSize(new Dimension(200, 100));
    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(this._vScrollBar.getWidth(), this.getHeight());
    this._vScrollBar.setSize(20, this.getHeight());
    this._vScrollBar.setLocation(this.getWidth() - this._vScrollBar.getWidth(), 0);
}
 
Example 39
Project: MeteoInfoLib   File: MapLayout.java   View source code 6 votes vote down vote up
public void onScrollValueChanged(AdjustmentEvent e) {
    if (e.getSource() == _vScrollBar) {
        //_vScrollBar.setValue(e.getValue());            
        //this._yShift = - this._vScrollBar.getValue();
        int y = -e.getValue();
        if (y == 1) {
            y = 0;
        }
        this._pageLocation.Y = y;
    }
    if (e.getSource() == _hScrollBar) {
        //_hScrollBar.setValue(e.getValue());       
        //this._xShift = - this._hScrollBar.getValue();
        int x = -e.getValue();
        if (x == 1) {
            x = 0;
        }
        this._pageLocation.X = x;
    }
    this.paintGraphics();
    //this.repaint();
}
 
Example 40
Project: VarJ   File: ScrollPaneAdjustable.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}