private void scrollHalfPage() { double sa = myScrollPane.getVerticalScrollBar().getVisibleAmount() / 2.0; double offset = Math.ceil(sa / myLineHeight) * myLineHeight; scrollOffset((int)offset); }
private void scrollPage() { scrollOffset(myScrollPane.getVerticalScrollBar().getVisibleAmount()); }
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 --"); } }
int value = scrollBar.getValue(); int maximum = scrollBar.getMaximum(); int visibleAmount = scrollBar.getVisibleAmount(); scrollBar.setMaximum(maximum); if(scrollBar.getVisibleAmount() != visibleAmount) { scrollBar.setVisibleAmount(visibleAmount);
if(comp instanceof JScrollBar){ JScrollBar scrollBar = (JScrollBar) comp; visibleAmount = scrollBar.getVisibleAmount(); if(comp instanceof JScrollBar) { JScrollBar scrollBar = (JScrollBar) comp; visibleAmount = scrollBar.getVisibleAmount();
public void adjustmentValueChanged(AdjustmentEvent evt) { sp.redrawScatterPlot(); ((JLabel)sp.slideLabels.get(index)).setText("Viewing Range: " + "[" + ((JScrollBar)sp.scrollers.get(index)).getValue() + ", " + (((JScrollBar)sp.scrollers.get(index)).getValue() + ((JScrollBar)sp.scrollers.get(index)).getVisibleAmount()) + "]"); } }
/** * Checks if the scroll position is at the end of the document, with * some margin or error. * * @return true if scroll position is at the end, false otherwise */ private boolean isScrollPositionNearEnd() { JScrollBar vbar = scrollpane.getVerticalScrollBar(); return vbar.getMaximum() - 20 <= vbar.getValue() + vbar.getVisibleAmount(); }
public void mouseWheelMoved(MouseWheelEvent e) { JScrollBar vbar = inboxScrollPane.getVerticalScrollBar(); if (vbar==null) return; disableAutoScroll = ((vbar.getValue() + vbar.getVisibleAmount()) != vbar.getMaximum()); } });
private void calculateButtonsEnabled() { float extent = scrollbar.getVisibleAmount(); float range = scrollbar.getMaximum() - scrollbar.getMinimum(); buttonsEnabled = (range > extent); }
@Override public void actionPerformed(ActionEvent e) { int now = scrollbar.getValue(); int height = scrollbar.getVisibleAmount(); height = height - height / 10; int newValue = 0; switch (action) { case "pageUp": newValue = now - height; break; case "pageDown": newValue = now + height; break; } scrollbar.setValue(newValue); } }
public void focusLost(FocusEvent evt) { JScrollBar currentBar = ((JScrollBar)sp.scrollers.get(index)); currentBar.setValue((int)Math.floor(currentBar.getMinimum())); int newVisibleAmount = (int)Double.parseDouble(((JTextField)this.sp.granularity.get(index)).getText()); if (newVisibleAmount > Math.ceil(currentBar.getMaximum()) - Math.floor(currentBar.getMinimum())) newVisibleAmount = (int)(Math.ceil(currentBar.getMaximum()) - Math.floor(currentBar.getMinimum())); currentBar.setVisibleAmount(newVisibleAmount); ((JLabel)sp.slideLabels.get(index)).setText("Viewing Range: [" + currentBar.getValue() + ", " + (currentBar.getValue() + currentBar.getVisibleAmount()) + "]"); } }
private void updateVerticalScrollbar() { JScrollBar vScrollbar = extendedTableScrollPane.getVerticalScrollBar(); vScrollbar.setEnabled(JExtendedTablePanel.this.isEnabled() && vScrollbar.getVisibleAmount() < vScrollbar.getMaximum()); }
public void stateChanged(ChangeEvent e) { vScrollbar.setEnabled(ResultsPanel.this.isEnabled() && vScrollbar.getVisibleAmount() < vScrollbar.getMaximum()); } });
private void centerAtCurrentDay() { int w = nbBeforeDays * datesPanel.getDayWidth(); int b = (horizontalScrollBar.getVisibleAmount() - datesPanel.getDayWidth()) / 2; horizontalScrollBar.setValue(w - b); }
public void stateChanged(ChangeEvent e) { scrollBar.setEnabled(ProfilerTableContainer.this.isEnabled() && scrollBar.getVisibleAmount() < scrollBar.getMaximum()); } });
public void adjustmentValueChanged(AdjustmentEvent event) { JScrollBar vbar = (JScrollBar) event.getSource(); if (!event.getValueIsAdjusting()) { return; } disableAutoScroll = ((vbar.getValue() + vbar.getVisibleAmount()) != vbar.getMaximum()); } });
public void stateChanged(ChangeEvent e) { Component c = treeTableViewport.getView(); vScrollBar.setEnabled(JTreeTablePanel.this.isEnabled() && vScrollBar.getVisibleAmount() < vScrollBar.getMaximum()); } });
private void enableOrDisableButtons() { final int value = scrollBar.getValue(); final int maxValue = scrollBar.getMaximum() - scrollBar.getVisibleAmount(); upButton.setEnabled(value > 0); downButton.setEnabled(value < maxValue); }
private void scrollDown() { final int unitIncrement = scrollBar.getUnitIncrement(); final int value = scrollBar.getValue(); final int maxValue = scrollBar.getMaximum() - scrollBar.getVisibleAmount(); int newValue = value + unitIncrement; if (newValue >= maxValue) { newValue = maxValue; } scrollBar.setValue(newValue); }
public void adjustmentValueChanged(AdjustmentEvent e) { JScrollBar rSB = rightScrollPane.getVerticalScrollBar(); verticalScrollBar.removeAdjustmentListener(verticalScrollBarAdjustementListener); verticalScrollBar.setMinimum(rSB.getMinimum()); verticalScrollBar.setMaximum(rSB.getMaximum()); verticalScrollBar.setBlockIncrement(rSB.getBlockIncrement()); verticalScrollBar.setUnitIncrement(rSB.getUnitIncrement()); verticalScrollBar.setVisibleAmount(rSB.getVisibleAmount()); verticalScrollBar.addAdjustmentListener(verticalScrollBarAdjustementListener); } }