类java.awt.Scrollbar源码实例Demo

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

源代码1 项目: TencentKona-8   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码2 项目: jdk8u60   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? acc.getPeer(component) : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick && acc.canBeFocusOwner(component);
}
 
源代码5 项目: openjdk-jdk9   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码6 项目: openjdk-jdk9   文件: ScrollbarDriver.java
@Override
protected Point getClickPoint(ComponentOperator oper, int direction, int orientation) {
    int x, y;
    if (orientation == Scrollbar.HORIZONTAL) {
        if (direction == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
            x = oper.getWidth() - 1 - CLICK_OFFSET;
        } else if (direction == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
            x = CLICK_OFFSET;
        } else {
            return null;
        }
        y = oper.getHeight() / 2;
    } else if (orientation == Scrollbar.VERTICAL) {
        if (direction == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
            y = oper.getHeight() - 1 - CLICK_OFFSET;
        } else if (direction == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
            y = CLICK_OFFSET;
        } else {
            return null;
        }
        x = oper.getWidth() / 2;
    } else {
        return null;
    }
    return new Point(x, y);
}
 
源代码7 项目: jdk8u-jdk   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码8 项目: jdk8u-jdk   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码9 项目: hottub   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码10 项目: openjdk-8-source   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码11 项目: jdk8u-dev-jdk   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
源代码12 项目: openjdk-8   文件: LWScrollBarPeer.java
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
源代码14 项目: jdk8u-jdk   文件: KeyboardFocusManagerPeerImpl.java
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
源代码16 项目: jdk8u60   文件: KeyboardFocusManagerPeerImpl.java
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
源代码18 项目: netbeans   文件: ScrollbarBeanInfo.java
/** @return Propertydescriptors */
@Override
protected PropertyDescriptor[] createPDs() throws IntrospectionException {
    PropertyDescriptor[] pds = new PropertyDescriptor[] {
        new PropertyDescriptor("unitIncrement", Scrollbar.class), // NOI18N
        new PropertyDescriptor("minimum", Scrollbar.class), // NOI18N
        new PropertyDescriptor("maximum", Scrollbar.class), // NOI18N
        new PropertyDescriptor("value", Scrollbar.class), // NOI18N
        new PropertyDescriptor("blockIncrement", Scrollbar.class), // NOI18N
        new PropertyDescriptor("orientation", Scrollbar.class), // NOI18N
        new PropertyDescriptor("visibleAmount", Scrollbar.class), // NOI18N
    };
    pds[5].setPropertyEditorClass(ScrollbarBeanInfo.OrientationPropertyEditor.class);
    return pds;
}
 
源代码19 项目: netbeans   文件: ScrollbarBeanInfo.java
@Override
public void setAsText(String s) {
    Integer i;
    getTags();
    if (s.equals(tags[0])) i = new Integer(Scrollbar.HORIZONTAL);
    else i = new Integer(Scrollbar.VERTICAL);
    setValue(i);
}
 
源代码20 项目: SPIM_Registration   文件: BoundingBoxGUI.java
protected GenericDialog getSimpleDialog( final boolean compress, final boolean allowModifyDimensions )
{
	final int[] rangeMin = new int[ 3 ];
	final int[] rangeMax = new int[ 3 ];

	setUpDefaultValues( rangeMin, rangeMax );

	final GenericDialog gd = new GenericDialog( "Manually define Bounding Box" );

	gd.addMessage( "Note: Coordinates are in global coordinates as shown " +
			"in Fiji status bar of a fused datasets", GUIHelper.smallStatusFont );

	if ( !compress )
		gd.addMessage( "", GUIHelper.smallStatusFont );

	gd.addSlider( "Minimal_X", rangeMin[ 0 ], rangeMax[ 0 ], this.min[ 0 ] );
	gd.addSlider( "Minimal_Y", rangeMin[ 1 ], rangeMax[ 1 ], this.min[ 1 ] );
	gd.addSlider( "Minimal_Z", rangeMin[ 2 ], rangeMax[ 2 ], this.min[ 2 ] );

	if ( !compress )
		gd.addMessage( "" );

	gd.addSlider( "Maximal_X", rangeMin[ 0 ], rangeMax[ 0 ], this.max[ 0 ] );
	gd.addSlider( "Maximal_Y", rangeMin[ 1 ], rangeMax[ 1 ], this.max[ 1 ] );
	gd.addSlider( "Maximal_Z", rangeMin[ 2 ], rangeMax[ 2 ], this.max[ 2 ] );

	if ( !allowModifyDimensions )
	{
		for ( int i = gd.getSliders().size() - 6; i < gd.getSliders().size(); ++i )
			((Scrollbar)gd.getSliders().get( i )).setEnabled( false );

		for ( int i = gd.getNumericFields().size() - 6; i < gd.getNumericFields().size(); ++i )
			((TextField)gd.getNumericFields().get( i )).setEnabled( false );
	}

	return gd;
}
 
源代码21 项目: openjdk-jdk9   文件: ScrollPaneDriver.java
@Override
public void scrollToMinimum(ComponentOperator oper, final int orientation) {
    final Adjustable adj
            = (orientation == Scrollbar.HORIZONTAL)
                    ? ((ScrollPaneOperator) oper).getHAdjustable()
                    : ((ScrollPaneOperator) oper).getVAdjustable();
    scroll(oper,
            new ScrollAdjuster() {
        @Override
        public int getScrollDirection() {
            return ((adj.getMinimum() < adj.getValue())
                    ? DECREASE_SCROLL_DIRECTION
                    : DO_NOT_TOUCH_SCROLL_DIRECTION);
        }

        @Override
        public int getScrollOrientation() {
            return orientation;
        }

        @Override
        public String getDescription() {
            return "Scroll to minimum";
        }

        @Override
        public String toString() {
            return "scrollToMinimum.ScrollAdjuster{description = " + getDescription() + '}';
        }
    });
}
 
源代码22 项目: openjdk-jdk9   文件: ScrollPaneDriver.java
@Override
public void scrollToMaximum(ComponentOperator oper, final int orientation) {
    final Adjustable adj
            = (orientation == Scrollbar.HORIZONTAL)
                    ? ((ScrollPaneOperator) oper).getHAdjustable()
                    : ((ScrollPaneOperator) oper).getVAdjustable();
    scroll(oper,
            new ScrollAdjuster() {
        @Override
        public int getScrollDirection() {
            return (((adj.getMaximum() - adj.getVisibleAmount()) > adj.getValue())
                    ? INCREASE_SCROLL_DIRECTION
                    : DO_NOT_TOUCH_SCROLL_DIRECTION);
        }

        @Override
        public int getScrollOrientation() {
            return orientation;
        }

        @Override
        public String getDescription() {
            return "Scroll to maximum";
        }

        @Override
        public String toString() {
            return "scrollToMaximum.ScrollAdjuster{description = " + getDescription() + '}';
        }
    });
}
 
源代码23 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Constructs a ScrollbarOperator object.
 *
 * @param cont a container
 * @param index an index between appropriate ones.
 */
public ScrollbarOperator(ContainerOperator<?> cont, int index) {
    this((Scrollbar) waitComponent(cont,
            new ScrollbarFinder(),
            index));
    copyEnvironment(cont);
}
 
源代码24 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Maps {@code Scrollbar.addAdjustmentListener(AdjustmentListener)}
 * through queue
 */
public void addAdjustmentListener(final AdjustmentListener adjustmentListener) {
    runMapping(new MapVoidAction("addAdjustmentListener") {
        @Override
        public void map() {
            ((Scrollbar) getSource()).addAdjustmentListener(adjustmentListener);
        }
    });
}
 
源代码25 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Maps {@code Scrollbar.getBlockIncrement()} through queue
 */
public int getBlockIncrement() {
    return (runMapping(new MapIntegerAction("getBlockIncrement") {
        @Override
        public int map() {
            return ((Scrollbar) getSource()).getBlockIncrement();
        }
    }));
}
 
源代码26 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Maps {@code Scrollbar.getMaximum()} through queue
 */
public int getMaximum() {
    return (runMapping(new MapIntegerAction("getMaximum") {
        @Override
        public int map() {
            return ((Scrollbar) getSource()).getMaximum();
        }
    }));
}
 
源代码27 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Maps {@code Scrollbar.getMinimum()} through queue
 */
public int getMinimum() {
    return (runMapping(new MapIntegerAction("getMinimum") {
        @Override
        public int map() {
            return ((Scrollbar) getSource()).getMinimum();
        }
    }));
}
 
源代码28 项目: SPIM_Registration   文件: InteractiveIntegral.java
public Radius1Listener( final Label label, final float min, final float max, final int scrollbarSize, final Scrollbar radiusScrollbar1,  final Scrollbar radiusScrollbar2, final Label radiusText2  )
{
	this.label = label;
	this.min = min;
	this.max = max;
	this.scrollbarSize = scrollbarSize;
	
	this.radiusScrollbar1 = radiusScrollbar1;
	this.radiusScrollbar2 = radiusScrollbar2;
	this.radiusText2 = radiusText2;
}
 
源代码29 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Maps {@code Scrollbar.getUnitIncrement()} through queue
 */
public int getUnitIncrement() {
    return (runMapping(new MapIntegerAction("getUnitIncrement") {
        @Override
        public int map() {
            return ((Scrollbar) getSource()).getUnitIncrement();
        }
    }));
}
 
源代码30 项目: openjdk-jdk9   文件: ScrollbarOperator.java
/**
 * Maps {@code Scrollbar.getValue()} through queue
 */
public int getValue() {
    return (runMapping(new MapIntegerAction("getValue") {
        @Override
        public int map() {
            return ((Scrollbar) getSource()).getValue();
        }
    }));
}
 
 类所在包
 类方法
 同包方法