JScrollBar vertical = scrollPane.getVerticalScrollBar(); vertical.setValue( vertical.getMaximum() );
private void scrollOffset(int more) { myAtEnd = false; int val = myScrollPane.getVerticalScrollBar().getValue(); myScrollPane.getVerticalScrollBar().setValue(val + more); myScrollPane.getHorizontalScrollBar().setValue(0); if (val + more >= myScrollPane.getVerticalScrollBar().getMaximum() - myScrollPane.getVerticalScrollBar().getVisibleAmount()) { myAtEnd = true; myLabel.setText("Hit ENTER or type command to continue"); } else { myLabel.setText("-- MORE --"); } }
@Override public void run() { JScrollBar verticalScrollbar = scrollPane.getVerticalScrollBar(); if (verticalScrollbar == null) return; int scrollMax = verticalScrollbar.getMaximum() - verticalScrollbar.getMinimum(); long newScrollValue = Math.round(position * scrollMax) + verticalScrollbar.getMinimum(); if (newScrollValue < verticalScrollbar.getMinimum()) newScrollValue = verticalScrollbar.getMinimum(); if (newScrollValue > verticalScrollbar.getMaximum()) newScrollValue = verticalScrollbar.getMaximum(); verticalScrollbar.setValue((int) newScrollValue); } });
private int actualMax() { return vertical.getMaximum() - vertical.getModel().getExtent(); }
private void showMatchedPart(int idx) { Point2D.Double coord = matchedPartCoordinates.get(idx); Dimension treeSize = tjp.getPreferredSize(); JScrollBar horizontal = scroller.getHorizontalScrollBar(); JScrollBar vertical = scroller.getVerticalScrollBar(); int horizontalLength = horizontal.getMaximum() - horizontal.getMinimum(); double x = Math.max(0, (coord.getX() / treeSize.getWidth() * horizontalLength - (scroller.getWidth() / 2.0))); int verticalLength = vertical.getMaximum() - vertical.getMinimum(); double y = Math.max(0, (coord.getY() / treeSize.getHeight() * verticalLength - (scroller.getHeight() / 2.0))); horizontal.setValue((int) x); vertical.setValue((int) y); }
@Override public void adjustmentValueChanged(AdjustmentEvent e) { String content = textArea.getText(); if (content == null || content.length() == 0) return; int scrollValue = verticalScrollbar.getValue() - verticalScrollbar.getMinimum(); int scrollMax = verticalScrollbar.getMaximum() - verticalScrollbar.getMinimum(); if (scrollMax < 1 || scrollValue < 0 || scrollValue > scrollMax) return; lastScrollPercent = (((double) scrollValue) / ((double) scrollMax)); } });
public void setWatched(boolean watched) { this.watched = watched; final JScrollBar horizontalScrollBar = ((ModelChartImpl) getLastMaximizedChartPanelView().getModelChart()).getHorizontalScrollBar(); if (watched) { horizontalScrollBar.setValue(horizontalScrollBar.getMaximum()); } horizontalScrollBar.setEnabled(!watched); }
scrollModelUpdateBySystem = true; int value = scrollBar.getValue(); int maximum = scrollBar.getMaximum(); int visibleAmount = scrollBar.getVisibleAmount(); if(scrollBar.getMaximum() != maximum) { scrollBar.setMaximum(maximum);
boolean leftToRight = comp.getComponentOrientation().isLeftToRight(); int scrollMin = toScroll.getMinimum(); int scrollMax = toScroll.getMaximum() - toScroll.getModel().getExtent(); int newValue = oldValue + delta; if (delta > 0 && newValue < oldValue) { newValue = toScroll.getMaximum(); } else if (delta < 0 && newValue > oldValue) { newValue = toScroll.getMinimum(); int newValue = oldValue + delta; if (delta > 0 && newValue < oldValue) { newValue = toScroll.getMaximum(); } else if (delta < 0 && newValue > oldValue) { newValue = toScroll.getMinimum();
JScrollBar vertical = v.getVerticalScrollBar(); int extent = vertical.getModel().getExtent(); boolean isScrollBarAtEnd = vertical.getValue() >= vertical.getMaximum() - extent; vertical.setValue(vertical.getMaximum() + 1);
@Override public Integer call() throws Exception { return bar.getMaximum(); } }));
public void run() { JScrollBar scrollBar = scrollPane.getVerticalScrollBar(); if (scrollBar != null) scrollBar.setValue(scrollBar.getMaximum()); } });
public void printConsole(String str) { consoleArea.append(str + "\n"); JScrollBar scrBar = consoleScrPane.getVerticalScrollBar(); int maxPos = scrBar.getMaximum(); scrBar.setValue(maxPos); }
@Override public void run() { jScrollPane1.getVerticalScrollBar().setValue( jScrollPane1.getVerticalScrollBar().getMaximum()); } });
@Override public void run() { scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum()); } });
private void scrollDown() { scroll.validate(); scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum()); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum()); } }); }
@Override public void run() { RcKalturaVideoUploadToolJPanel.this.statusJScrollPane.getVerticalScrollBar().setValue(RcKalturaVideoUploadToolJPanel.this.statusJScrollPane.getVerticalScrollBar().getMaximum()); RcKalturaVideoUploadToolJPanel.this.statusJScrollPane.getHorizontalScrollBar().setValue(0); } });
scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent event) { JScrollBar scrollBar = (JScrollBar) event.getAdjustable(); int extent = scrollBar.getModel().getExtent(); System.out.println("1. Value: " + (scrollBar.getValue() + extent) + " Max: " + scrollBar.getMaximum()); } });
public void stateChanged(ChangeEvent e) { vScrollbar.setEnabled(ResultsPanel.this.isEnabled() && vScrollbar.getVisibleAmount() < vScrollbar.getMaximum()); } });
/** * Refresh the textarea and scroll to the end */ private void refreshDisplay() { this.textArea.setCaretPosition(this.textArea.getDocument().getLength()); this.textArea.scrollRectToVisible(this.textArea.getVisibleRect()); this.scrollPane.getVerticalScrollBar().setValue(this.scrollPane.getVerticalScrollBar().getMaximum()); this.textArea.paintImmediately(0,0,this.textArea.getWidth(), this.textArea.getHeight()); }