Java Code Examples for java.awt.peer.ScrollPanePeer

The following examples show how to use java.awt.peer.ScrollPanePeer. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: jdk-1.7-annotated   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();
    Insets i = getInsets();

    c.reshape(i.left - p.x, i.top - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 2
Source Project: jdk1.8-source-analysis   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 3
Source Project: jdk1.8-source-analysis   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 4
Source Project: dragonwell8_jdk   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 5
Source Project: dragonwell8_jdk   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 6
Source Project: dragonwell8_jdk   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 7
Source Project: TencentKona-8   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 8
Source Project: TencentKona-8   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 9
Source Project: TencentKona-8   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 10
Source Project: jdk8u60   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 11
Source Project: jdk8u60   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 12
Source Project: jdk8u60   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 13
Source Project: JDKSourceCode1.8   Source File: ScrollPane.java    License: MIT License 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 14
Source Project: JDKSourceCode1.8   Source File: ScrollPane.java    License: MIT License 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 15
Source Project: openjdk-jdk8u   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 16
Source Project: openjdk-jdk8u   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 17
Source Project: openjdk-jdk8u   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 18
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 19
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 20
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 21
Source Project: Bytecoder   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by {@code doLayout()}.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 22
Source Project: Bytecoder   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
@SuppressWarnings("deprecation")
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 23
Source Project: Bytecoder   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
@SuppressWarnings("deprecation")
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 24
Source Project: openjdk-jdk9   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by {@code doLayout()}.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}
 
Example 25
Source Project: openjdk-jdk9   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
@SuppressWarnings("deprecation")
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 26
Source Project: openjdk-jdk9   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
@SuppressWarnings("deprecation")
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 27
Source Project: jdk8u-jdk   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 28
Source Project: jdk8u-jdk   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 29
Source Project: jdk8u-jdk   Source File: ScrollPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoked when the value of the adjustable has changed.
 */
public void adjustmentValueChanged(AdjustmentEvent e) {
    Adjustable adj = e.getAdjustable();
    int value = e.getValue();
    ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
    if (peer != null) {
        peer.setValue(adj, value);
    }

    Component c = scroller.getComponent(0);
    switch(adj.getOrientation()) {
    case Adjustable.VERTICAL:
        c.move(c.getLocation().x, -(value));
        break;
    case Adjustable.HORIZONTAL:
        c.move(-(value), c.getLocation().y);
        break;
    default:
        throw new IllegalArgumentException("Illegal adjustable orientation");
    }
}
 
Example 30
Source Project: Java8CN   Source File: ScrollPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>doLayout()</code>.
 */
@Deprecated
public void layout() {
    if (getComponentCount()==0) {
        return;
    }
    Component c = getComponent(0);
    Point p = getScrollPosition();
    Dimension cs = calculateChildSize();
    Dimension vs = getViewportSize();

    c.reshape(- p.x, - p.y, cs.width, cs.height);
    ScrollPanePeer peer = (ScrollPanePeer)this.peer;
    if (peer != null) {
        peer.childResized(cs.width, cs.height);
    }

    // update adjustables... the viewport size may have changed
    // with the scrollbars coming or going so the viewport size
    // is updated before the adjustables.
    vs = getViewportSize();
    hAdjustable.setSpan(0, cs.width, vs.width);
    vAdjustable.setSpan(0, cs.height, vs.height);
}