类java.awt.Adjustable源码实例Demo

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

源代码1 项目: openjdk-8   文件: ScrollPaneWheelScroller.java
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
 
源代码2 项目: openjdk-jdk9   文件: ScrollPaneOperator.java
/**
 * Scrolls pane to bottom.
 *
 * @throws TimeoutExpiredException
 */
public void scrollToBottom() {
    output.printTrace("Scroll ScrollPane to bottom\n"
            + toStringSource());
    output.printGolden("Scroll ScrollPane to bottom");
    produceTimeRestricted(new Action<Void, Void>() {
        @Override
        public Void launch(Void obj) {
            driver.scrollToMaximum(ScrollPaneOperator.this, Adjustable.VERTICAL);
            return null;
        }

        @Override
        public String getDescription() {
            return "Scrolling";
        }

        @Override
        public String toString() {
            return "ScrollPaneOperator.scrollToBottom.Action{description = " + getDescription() + '}';
        }
    }, "ScrollbarOperator.WholeScrollTimeout");
}
 
源代码3 项目: 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);
    }
}
 
源代码4 项目: openjdk-jdk9   文件: ScrollPaneOperator.java
/**
 * Scrolls pane to right.
 *
 * @throws TimeoutExpiredException
 */
public void scrollToRight() {
    output.printTrace("Scroll ScrollPane to right\n"
            + toStringSource());
    output.printGolden("Scroll ScrollPane to right");
    produceTimeRestricted(new Action<Void, Void>() {
        @Override
        public Void launch(Void obj) {
            driver.scrollToMaximum(ScrollPaneOperator.this, Adjustable.HORIZONTAL);
            return null;
        }

        @Override
        public String getDescription() {
            return "Scrolling";
        }

        @Override
        public String toString() {
            return "ScrollPaneOperator.scrollToRight.Action{description = " + getDescription() + '}';
        }
    }, "ScrollbarOperator.WholeScrollTimeout");
}
 
源代码5 项目: hottub   文件: ScrollPaneWheelScroller.java
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
 
源代码6 项目: dragonwell8_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);
    }
}
 
源代码7 项目: jdk8u-jdk   文件: ScrollPaneWheelScroller.java
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
 
源代码8 项目: jdk8u-dev-jdk   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码9 项目: rapidminer-studio   文件: ScrollBarUI.java
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
	int x = (int) trackBounds.getX();
	int y = (int) trackBounds.getY();
	int w = (int) trackBounds.getWidth();
	int h = (int) trackBounds.getHeight();

	g.setColor(Colors.SCROLLBAR_TRACK_BACKGROUND);
	g.fillRect(x - 1, y - 1, w + 2, h + 2);

	g.setColor(Colors.SCROLLBAR_TRACK_BORDER);
	if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
		g.drawLine(x, y, x + w, y);
	} else {
		g.drawLine(x, y, x, y + h);
	}
}
 
源代码10 项目: jdk8u60   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码11 项目: 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);
    }
}
 
源代码12 项目: openjdk-8-source   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码13 项目: jdk8u_jdk   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码14 项目: openjdk-jdk8u   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码15 项目: openjdk-jdk8u   文件: ScrollPaneWheelScroller.java
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
 
源代码16 项目: openjdk-8   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码18 项目: jdk8u-jdk   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码19 项目: Bytecoder   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码20 项目: hottub   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码21 项目: jdk8u-jdk   文件: ScrollPaneWheelScroller.java
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
 
源代码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 项目: dragonwell8_jdk   文件: ScrollPaneWheelScroller.java
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
源代码24 项目: TencentKona-8   文件: ScrollPaneWheelScroller.java
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
源代码25 项目: jdk8u60   文件: ScrollPaneWheelScroller.java
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
源代码26 项目: openjdk-jdk9   文件: ScrollPaneOperator.java
/**
 * Maps {@code ScrollPane.getVAdjustable()} through queue
 */
public Adjustable getVAdjustable() {
    return (runMapping(new MapAction<Adjustable>("getVAdjustable") {
        @Override
        public Adjustable map() {
            return ((ScrollPane) getSource()).getVAdjustable();
        }
    }));
}
 
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
源代码28 项目: rapidminer-studio   文件: ScrollBarUI.java
@Override
public Dimension getPreferredSize(JComponent c) {
	if (this.scrollbar.getOrientation() == Adjustable.VERTICAL) {
		return new Dimension(SCROLLBAR_WIDTH, 53 + 10);
	} else {
		return new Dimension(100, SCROLLBAR_WIDTH);
	}
}
 
源代码29 项目: Bytecoder   文件: ScrollPaneWheelScroller.java
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
源代码30 项目: openjdk-jdk9   文件: ScrollPaneOperator.java
/**
 * Scrolls vertical scroll bar.
 *
 * @param proportionalValue Value to scroll vertical scroll bar to.
 * @throws TimeoutExpiredException
 */
public void scrollToVerticalValue(double proportionalValue) {
    output.printTrace("Scroll ScrollPane to " + Double.toString(proportionalValue) + " proportional vertical value \n"
            + toStringSource());
    output.printGolden("Scroll ScrollPane to " + Double.toString(proportionalValue) + " proportional vertical value");
    Adjustable adj = getVAdjustable();
    scrollTo(new ValueScrollAdjuster((int) (adj.getMinimum()
            + (adj.getMaximum()
            - adj.getVisibleAmount()
            - adj.getMinimum()) * proportionalValue),
            Adjustable.VERTICAL,
            getVAdjustable()));
}
 
 类所在包
 同包方法