Java 类javax.swing.JScrollBar 实例源码

项目:openjdk-jdk10    文件:Test7163696.java   
public void run() {
    if (this.bar == null) {
        this.bar = new JScrollBar(JScrollBar.HORIZONTAL, 50, 10, 0, 100);
        this.bar.setPreferredSize(new Dimension(400, 20));

        JFrame frame = new JFrame();
        frame.add(this.bar);
        frame.pack();
        frame.setVisible(true);
    }
    else if (40 != this.bar.getValue()) {
        System.out.println("name = " + UIManager.getLookAndFeel().getName());
        System.out.println("value = " + this.bar.getValue());
    }
    else {
        SwingUtilities.getWindowAncestor(this.bar).dispose();
        this.bar = null;
    }
}
项目:geomapapp    文件:XYGraph.java   
void doZoom( Point p, double factor ) {
    if( scPane == null || ( tracksWidth && tracksHeight ))return;
    Insets ins = axes.getInsets();
    Rectangle rect = getVisibleRect();
    double x = (double)(p.x-ins.left) / zoom;
    double y = (double)(p.y-ins.top) / zoom;
    double w = (double) (rect.width - ins.left - ins.right);
    double h = (double) (rect.height - ins.top - ins.bottom);
    zoom *= factor;
    int newX = (int) (x*zoom - w*.5d);
    int newY = (int) (y*zoom - h*.5d);
    invalidate();
    scPane.validate();
    JScrollBar sb;
    if(!tracksWidth) {
        sb = scPane.getHorizontalScrollBar();
        sb.setValue(newX);
    }
    if(!tracksHeight) {
        sb = scPane.getVerticalScrollBar();
        sb.setValue(newY);
    }
    revalidate();
}
项目:incubator-netbeans    文件:ProfilerTableContainer.java   
private void updateHorizontalScrollBars(ProfilerTable table, int column, boolean layout) {
    if (column != -1) {
        JScrollBar scroll = getScroller(column);
        int offset = table.getColumnOffset(column);
        int columnPref = table.getColumnPreferredWidth(column);
        int _column = table.convertColumnIndexToView(column);
        int columnAct = table.getTableHeader().getHeaderRect(_column).width;
        if (columnPref > columnAct) {
            int value = Math.min(offset, columnPref - columnAct);
            scroll.setValues(value, columnAct, 0, columnPref);
        } else {
            scroll.setValues(0, 0, 0, 0);
        }
    }

    if (layout) {
        doLayout();
        scrollersPanel.doLayout();
        repaint();
    }
}
项目:geomapapp    文件:SCSImage2.java   
public void doZoom( Point p, double factor ) {
Rectangle rect = getVisibleRect();
double x = p.getX() / zoom;
        double y = p.getY() / zoom;
        double w = rect.getWidth();
        double h = rect.getHeight();
        zoom *= factor;
zoomX = zoomY = zoom;
        int newX = (int) (x*zoom - w*.5d);
        int newY = (int) (y*zoom - h*.5d);
        invalidate();
        scrollPane.validate();
        JScrollBar sb = scrollPane.getHorizontalScrollBar();
        sb.setValue(newX);
        sb = scrollPane.getVerticalScrollBar();
        sb.setValue(newY);
        repaint();
}
项目:marathonv5    文件:RComponentFactory.java   
public static void reset() {
    entries.clear();
    add(Component.class, RUnknownComponent.class);
    add(Window.class, RWindow.class);
    add(JTable.class, RTable.class);
    add(JTableHeader.class, RTableHeader.class);
    add(AbstractButton.class, RAbstractButton.class);
    add(JToggleButton.class, RToggleButton.class);
    add(JComboBox.class, RComboBox.class);
    add(JTextComponent.class, RTextComponent.class);
    add(JTree.class, RTree.class);
    add(JList.class, RList.class);
    add(JTabbedPane.class, RTabbedPane.class);
    add(JMenuItem.class, RMenuItem.class);
    add(JSlider.class, RSlider.class);
    add(JProgressBar.class, RProgressBar.class);
    add(JSpinner.class, RSpinner.class);
    add(DefaultEditor.class, RDefaultEditor.class);
    add(JColorChooser.class, RColorChooser.class);
    add(JSplitPane.class, RSplitPane.class);
    add(BasicSplitPaneDivider.class, RSplitPane.class);
    add(JFileChooser.class, RFileChooser.class);
    add(JEditorPane.class, REditorPane.class);
    add(JLabel.class, RLabel.class);
    add(JScrollBar.class, RIgnoreComponent.class);
}
项目:Bootstrapper    文件:Bootstrapper.java   
public void print(String string) {
    System.out.print(string);


    Document document = this.textArea.getDocument();
    final JScrollBar scrollBar = this.scrollPane.getVerticalScrollBar();

    boolean shouldScroll = (scrollBar.getValue() + scrollBar.getSize().getHeight() +
            MONOSPACED.getSize() * 2 > scrollBar.getMaximum());
    try {
        document.insertString(document.getLength(), string, null);
    } catch (BadLocationException ignored) {

    }

    if (shouldScroll) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                scrollBar.setValue(2147483647);
            }
        });
    }
}
项目:geomapapp    文件:XYGraph.java   
void doZoom( Point p, double factor ) {
    if( scPane == null || ( tracksWidth && tracksHeight ))return;
    Insets ins = axes.getInsets();
    Rectangle rect = getVisibleRect();
    double x = (double)(p.x-ins.left) / zoom;
    double y = (double)(p.y-ins.top) / zoom;
    double w = (double) (rect.width - ins.left - ins.right);
    double h = (double) (rect.height - ins.top - ins.bottom);
    zoom *= factor;
    int newX = (int) (x*zoom - w*.5d);
    int newY = (int) (y*zoom - h*.5d);
    invalidate();
    scPane.validate();
    JScrollBar sb;
    if(!tracksWidth) {
        sb = scPane.getHorizontalScrollBar();
        sb.setValue(newX);
    }
    if(!tracksHeight) {
        sb = scPane.getVerticalScrollBar();
        sb.setValue(newY);
    }
    revalidate();
}
项目:OpenJSharp    文件: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);
    }
}
项目:OpenJSharp    文件:LWTextAreaPeer.java   
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
项目:OpenJSharp    文件:LWTextAreaPeer.java   
@Override
public void insert(final String text, final int pos) {
    final ScrollableJTextArea pane = getDelegate();
    synchronized (getDelegateLock()) {
        final JTextArea area = pane.getView();
        final boolean doScroll = pos >= area.getDocument().getLength()
                                 && area.getDocument().getLength() != 0;
        area.insert(text, pos);
        revalidate();
        if (doScroll) {
            final JScrollBar vbar = pane.getVerticalScrollBar();
            if (vbar != null) {
                vbar.setValue(vbar.getMaximum() - vbar.getVisibleAmount());
            }
        }
    }
    repaintPeer();
}
项目:OpenJSharp    文件:XTextAreaPeer.java   
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
项目:OpenJSharp    文件:XTextAreaPeer.java   
private boolean setPointerIfPointOverScrollbar( JScrollBar bar, Point point ) {
    if ( ! bar.getBounds().contains( point ) ) {
        return false;
    }
    current.setBar( bar );
    Point local = toLocalSpace( bar, point );

    XTextAreaPeer.XAWTScrollBarUI ui =
        (XTextAreaPeer.XAWTScrollBarUI) bar.getUI();

    if ( ! setPointerIfPointOverButton( ui.getIncreaseButton(), local ) ) {
        setPointerIfPointOverButton( ui.getDecreaseButton(), local );
    }

    return true;
}
项目:TrabalhoFinalEDA2    文件:mxGraphComponent.java   
/**
 *
 */
protected void maintainScrollBar(boolean horizontal, double factor,
        boolean center)
{
    JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar()
            : getVerticalScrollBar();

    if (scrollBar != null)
    {
        BoundedRangeModel model = scrollBar.getModel();
        int newValue = (int) Math.round(model.getValue() * factor)
                + (int) Math.round((center) ? (model.getExtent()
                        * (factor - 1) / 2) : 0);
        model.setValue(newValue);
    }
}
项目:geomapapp    文件:SCSImage2.java   
public void scrollTo (int t) {
    if(cruise==null) return;
    int i=0;
    int x=0;
    while( i<cruise.start.length && cruise.start[i]<t ) i++;
    if( i==cruise.start.length ) {
        x = width;
    } else if( t<cruise.start[i] ) {
        x = cruise.xPosition[i];
    } else if( t>cruise.start[i]+30*cruise.panelSize[i][0] ) {
        x = cruise.xPosition[i] + cruise.panelSize[i][0];
    } else {
        x = cruise.xPosition[i] + (t-cruise.start[i])/30;
    }
    Rectangle r = getVisibleRect();
    x = (int) (x*zoomX) - r.width/2;
    JScrollBar sb = scrollPane.getHorizontalScrollBar();
    sb.setValue(x);
    repaint();
}
项目:jdk8u-jdk    文件:XTextAreaPeer.java   
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
项目:jdk8u-jdk    文件:XTextAreaPeer.java   
private boolean setPointerIfPointOverScrollbar( JScrollBar bar, Point point ) {
    if ( ! bar.getBounds().contains( point ) ) {
        return false;
    }
    current.setBar( bar );
    Point local = toLocalSpace( bar, point );

    XTextAreaPeer.XAWTScrollBarUI ui =
        (XTextAreaPeer.XAWTScrollBarUI) bar.getUI();

    if ( ! setPointerIfPointOverButton( ui.getIncreaseButton(), local ) ) {
        setPointerIfPointOverButton( ui.getDecreaseButton(), local );
    }

    return true;
}
项目:jdk8u-jdk    文件:Test7163696.java   
public void run() {
    if (this.bar == null) {
        this.bar = new JScrollBar(JScrollBar.HORIZONTAL, 50, 10, 0, 100);
        this.bar.setPreferredSize(new Dimension(400, 20));

        JFrame frame = new JFrame();
        frame.add(this.bar);
        frame.pack();
        frame.setVisible(true);
    }
    else if (40 != this.bar.getValue()) {
        System.out.println("name = " + UIManager.getLookAndFeel().getName());
        System.out.println("value = " + this.bar.getValue());
    }
    else {
        SwingUtilities.getWindowAncestor(this.bar).dispose();
        this.bar = null;
    }
}
项目:jdk8u-jdk    文件:Test8039464.java   
private static void init(Container container) {
    container.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 1;
    JLabel label = new JLabel();
    Dimension size = new Dimension(111, 0);
    label.setPreferredSize(size);
    label.setMinimumSize(size);
    container.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1;
    container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 1;
    container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
项目:openjdk-jdk10    文件:XTextAreaPeer.java   
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
项目:openjdk-jdk10    文件:XTextAreaPeer.java   
private boolean setPointerIfPointOverScrollbar( JScrollBar bar, Point point ) {
    if ( ! bar.getBounds().contains( point ) ) {
        return false;
    }
    current.setBar( bar );
    Point local = toLocalSpace( bar, point );

    XTextAreaPeer.XAWTScrollBarUI ui =
        (XTextAreaPeer.XAWTScrollBarUI) bar.getUI();

    if ( ! setPointerIfPointOverButton( ui.getIncreaseButton(), local ) ) {
        setPointerIfPointOverButton( ui.getDecreaseButton(), local );
    }

    return true;
}
项目:openjdk-jdk10    文件:JScrollPaneOperator.java   
@Override
public int getScrollDirection(JScrollBarOperator oper) {
    Point toPoint = SwingUtilities.
            convertPoint(comp, x, y, getViewport().getView());
    int to = (orientation == JScrollBar.HORIZONTAL) ? toPoint.x : toPoint.y;
    int ln = (orientation == JScrollBar.HORIZONTAL) ? width : height;
    int lv = (orientation == JScrollBar.HORIZONTAL) ? getViewport().getWidth() : getViewport().getHeight();
    int vl = oper.getValue();
    if (to < vl) {
        return ScrollAdjuster.DECREASE_SCROLL_DIRECTION;
    } else if ((to + ln - 1) > (vl + lv)
            && to > vl) {
        return ScrollAdjuster.INCREASE_SCROLL_DIRECTION;
    } else {
        return ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION;
    }
}
项目:openjdk-jdk10    文件: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);
    }
}
项目:openjdk-jdk10    文件:LWTextAreaPeer.java   
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
项目:openjdk-jdk10    文件:LWTextAreaPeer.java   
@Override
public void insert(final String text, final int pos) {
    final ScrollableJTextArea pane = getDelegate();
    synchronized (getDelegateLock()) {
        final JTextArea area = pane.getView();
        final boolean doScroll = pos >= area.getDocument().getLength()
                                 && area.getDocument().getLength() != 0;
        area.insert(text, pos);
        revalidate();
        if (doScroll) {
            final JScrollBar vbar = pane.getVerticalScrollBar();
            if (vbar != null) {
                vbar.setValue(vbar.getMaximum() - vbar.getVisibleAmount());
            }
        }
    }
    repaintPeer();
}
项目:openjdk-jdk10    文件:JScrollPaneOperator.java   
/**
 * Scrolls pane to rectangle of a component.
 *
 * @param comp a subcomponent defining coordinate system.
 * @param x coordinate
 * @param y coordinate
 * @param width rectangle width
 * @param height rectangle height
 * @throws TimeoutExpiredException
 */
public void scrollToComponentRectangle(Component comp, int x, int y, int width, int height) {
    initOperators();
    makeComponentVisible();
    if (hScrollBarOper != null && hScrollBarOper.getSource().isVisible()) {
        hScrollBarOper.scrollTo(new ComponentRectChecker(comp, x, y, width, height, JScrollBar.HORIZONTAL));
    }
    if (vScrollBarOper != null && vScrollBarOper.getSource().isVisible()) {
        vScrollBarOper.scrollTo(new ComponentRectChecker(comp, x, y, width, height, JScrollBar.VERTICAL));
    }
}
项目:incubator-netbeans    文件:OutlineView.java   
@Override
public void addLayoutComponent(String s, Component c) {
    if (s.equals(TREE_HORIZONTAL_SCROLLBAR)) {
        thsb = (JScrollBar)addSingletonComponent(thsb, c);
    } else {
        super.addLayoutComponent(s, c);
    }
}
项目:incubator-netbeans    文件:OutlineView.java   
private JScrollBar createFakeHSB(final JScrollBar hsb) {
    return new JScrollBar(JScrollBar.HORIZONTAL) {

        @Override
        public Dimension getPreferredSize() {
            Dimension dim = hsb.getPreferredSize();
            return new Dimension(dim.width, 2*dim.height);
        }

    };
}
项目:openjdk-jdk10    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.getMinimum()} through queue
 */
public int getMinimum() {
    return (runMapping(new MapIntegerAction("getMinimum") {
        @Override
        public int map() {
            return ((JScrollBar) getSource()).getMinimum();
        }
    }));
}
项目:incubator-netbeans    文件:FileEditor.java   
private void hideShowButtons (Container cont, boolean val) {
    if (cont instanceof JComboBox || cont instanceof JScrollBar) {
        return;
    }
    Component[] c = cont.getComponents();
    for (int i=0; i < c.length; i++) {
        if (c[i] instanceof Container) {
            hideShowButtons ((Container) c[i], val);
        }
        if (c[i] instanceof AbstractButton) {
            c[i].setVisible(val);
        }
    }
}
项目:incubator-netbeans    文件:ChartPanel.java   
private void setWheelScrollHandler(final JScrollBar scrollBar) {
    chart.addMouseWheelListener(new MouseWheelListener() {
        public void mouseWheelMoved(MouseWheelEvent e) {
            scroll(scrollBar, e);
        }
    });
}
项目:incubator-netbeans    文件:ChartPanel.java   
private static void scroll(JScrollBar scrollBar, MouseWheelEvent e) {
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int unitsToScroll = e.getUnitsToScroll();
        int direction = unitsToScroll < 0 ? -1 : 1;
        if (unitsToScroll != 0) {
            int increment = scrollBar.getUnitIncrement(direction);
            int oldValue = scrollBar.getValue();
            int newValue = oldValue + increment * unitsToScroll;
            newValue = Math.max(Math.min(newValue, scrollBar.getMaximum() -
                    scrollBar.getVisibleAmount()), scrollBar.getMinimum());
            if (oldValue != newValue) scrollBar.setValue(newValue);
        }
    }
}
项目:openjdk-jdk10    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.setOrientation(int)} through queue
 */
public void setOrientation(final int i) {
    runMapping(new MapVoidAction("setOrientation") {
        @Override
        public void map() {
            ((JScrollBar) getSource()).setOrientation(i);
        }
    });
}
项目:incubator-netbeans    文件:JComponentBuilders.java   
static ComponentBuilder getBuilder(Instance instance, Heap heap) {
    if (DetailsUtils.isSubclassOf(instance, JLabel.class.getName())) {
        return new JLabelBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JPanel.class.getName())) {
        return new JPanelBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JToolBar.class.getName())) {
        return new JToolBarBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, Box.Filler.class.getName())) {
        return new BoxFillerBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, Box.class.getName())) {
        return new BoxBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JScrollBar.class.getName())) {
        return new JScrollBarBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JToolBar.Separator.class.getName())) {
        return new JToolBarSeparatorBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JPopupMenu.Separator.class.getName())) {
        return new JPopupMenuSeparatorBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JSeparator.class.getName())) {
        return new JSeparatorBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JProgressBar.class.getName())) {
        return new JProgressBarBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JSlider.class.getName())) {
        return new JSliderBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JSpinner.class.getName())) {
        return new JSpinnerBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JPopupMenu.class.getName())) {
        return new JPopupMenuBuilder(instance, heap);
    }
    return null;
}
项目:openjdk-jdk10    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.setValues(int, int, int, int)} through queue
 */
public void setValues(final int i, final int i1, final int i2, final int i3) {
    runMapping(new MapVoidAction("setValues") {
        @Override
        public void map() {
            ((JScrollBar) getSource()).setValues(i, i1, i2, i3);
        }
    });
}
项目:openjdk-jdk10    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.getUnitIncrement()} through queue
 */
public int getUnitIncrement() {
    return (runMapping(new MapIntegerAction("getUnitIncrement") {
        @Override
        public int map() {
            return ((JScrollBar) getSource()).getUnitIncrement();
        }
    }));
}
项目:incubator-netbeans    文件:ProfilerTableContainer.java   
private JScrollBar getScroller(int column) {
    for (Component component : scrollersPanel.getComponents()) {
        JScrollBar scroller = (JScrollBar)component;
        if (getColumn(scroller) == column) return scroller;
    }
    return null;
}
项目:incubator-netbeans    文件:ProfilerTableContainer.java   
private void configureVerticalScrollBar(final JScrollBar scrollBar) {
    scrollBar.getModel().addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            scrollBar.setEnabled(ProfilerTableContainer.this.isEnabled() &&
                      scrollBar.getVisibleAmount() < scrollBar.getMaximum());
        }
    });
}
项目:chipKIT-importer    文件:SerialMonitorDisplayPane.java   
private void checkScrollBar(AdjustmentEvent e) {
    //  The scroll bar listModel contains information needed to determine
    //  whether the viewport should be repositioned or not.

    JScrollBar scrollBar = (JScrollBar) e.getSource();
    BoundedRangeModel scrollBarModel = scrollBar.getModel();
    int value = scrollBarModel.getValue();
    int extent = scrollBarModel.getExtent();
    int maximum = scrollBarModel.getMaximum();

    boolean valueChanged = previousScrollBarValue != value;
    boolean maximumChanged = previousScrollBarMaximum != maximum;

    //  Check if the user has manually repositioned the scrollbar
    if (valueChanged && !maximumChanged) {
        adjustScrollBar = value + extent >= maximum;
    }

    //  Reset the "value" so we can reposition the viewport and
    //  distinguish between a user scroll and a program scroll.
    //  (ie. valueChanged will be false on a program scroll)
    if (adjustScrollBar) {
        //  Scroll the viewport to the end.
        scrollBar.removeAdjustmentListener(scrollBarAdjustmentListener);
        value = maximum - extent;
        scrollBar.setValue(value);
        scrollBar.addAdjustmentListener(scrollBarAdjustmentListener);
    }

    previousScrollBarValue = value;
    previousScrollBarMaximum = maximum;
}
项目:openjdk-jdk10    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.getVisibleAmount()} through queue
 */
public int getVisibleAmount() {
    return (runMapping(new MapIntegerAction("getVisibleAmount") {
        @Override
        public int map() {
            return ((JScrollBar) getSource()).getVisibleAmount();
        }
    }));
}
项目:incubator-netbeans    文件:DebuggingViewComponent.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    JScrollBar scrollBar = mainScrollPane.getVerticalScrollBar();
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int totalScrollAmount = e.getUnitsToScroll() * scrollBar.getUnitIncrement();
        scrollBar.setValue(scrollBar.getValue() + totalScrollAmount);
    }
}