java.awt.peer.ScrollPanePeer Java Examples

The following examples show how to use java.awt.peer.ScrollPanePeer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScrollPane.java    From Java8CN with 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);
}
 
Example #2
Source File: ScrollPane.java    From dragonwell8_jdk with 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 #3
Source File: ScrollPane.java    From dragonwell8_jdk with 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 #4
Source File: ScrollPane.java    From openjdk-jdk8u with 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 #5
Source File: ScrollPane.java    From openjdk-jdk8u-backup with 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 #6
Source File: ScrollPane.java    From openjdk-jdk8u-backup with 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 File: ScrollPane.java    From openjdk-jdk8u-backup with 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 #8
Source File: ScrollPane.java    From Bytecoder with 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 #9
Source File: ScrollPane.java    From Bytecoder with 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 #10
Source File: ScrollPane.java    From openjdk-jdk9 with 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 #11
Source File: ScrollPane.java    From openjdk-jdk9 with 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 #12
Source File: ScrollPane.java    From openjdk-jdk9 with 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 #13
Source File: ScrollPane.java    From jdk8u-jdk with 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 #14
Source File: ScrollPane.java    From jdk8u-jdk with 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 #15
Source File: ScrollPane.java    From jdk8u-jdk with 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 #16
Source File: ScrollPane.java    From Bytecoder with 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 #17
Source File: ScrollPane.java    From Java8CN with 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 #18
Source File: ScrollPane.java    From hottub with 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 #19
Source File: ScrollPane.java    From hottub with 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 #20
Source File: ScrollPane.java    From hottub with 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 #21
Source File: ScrollPane.java    From openjdk-8-source with 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();
    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 #22
Source File: ScrollPane.java    From openjdk-8-source with 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 #23
Source File: ScrollPane.java    From openjdk-8 with 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();
    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 #24
Source File: ScrollPane.java    From openjdk-8 with 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 #25
Source File: ScrollPane.java    From openjdk-8 with 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 #26
Source File: ScrollPane.java    From jdk8u_jdk with 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 #27
Source File: ScrollPane.java    From jdk8u_jdk with 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 File: ScrollPane.java    From jdk-1.7-annotated with 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 #29
Source File: ScrollPane.java    From jdk8u-dev-jdk with 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 File: ScrollPane.java    From jdk8u-jdk with 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();
    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);
}