List of usage examples for javax.swing JScrollBar getMinimum
public int getMinimum()
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomInY(final float factor) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar(); final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(1.1f);//from w w w. j a va2 s . com final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setYdistance((treepanel.getYdistance() * factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue( ForesterUtil.roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); treepanel.resetPreferredSize(); treepanel.updateOvSizes(); }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
public void scrollToBottom() { if (prologOutput.isShowing()) { prologOutput/*from w w w . jav a 2 s .c om*/ .setCaretPosition(prologOutput.getDocument().getEndPosition().getOffset() - 1 /* OBOB hack */); try { // If we're in a JScrollPane, force scrolling to bottom and left JScrollBar scrollbarV = ((JScrollPane) ((JViewport) (prologOutput.getParent())).getParent()) .getVerticalScrollBar(); scrollbarV.setValue(scrollbarV.getMaximum()); JScrollBar scrollbarH = ((JScrollPane) ((JViewport) (prologOutput.getParent())).getParent()) .getHorizontalScrollBar(); scrollbarH.setValue(scrollbarH.getMinimum()); } catch (Exception e) {/* We're not in a JScrollPane, forget it! */ } ; } }
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomInX(final float factor, final float x_correction_factor) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar(); final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(1f);/*from ww w . jav a 2 s.co m*/ if ((treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR) || (treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) || isDrawPhylogram(getMainPanel().getCurrentTabIndex()) || (getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP)) { final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setXdistance((treepanel.getXdistance() * factor)); treepanel.setXcorrectionFactor((treepanel.getXcorrectionFactor() * x_correction_factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(ForesterUtil .roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); } else { final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue(); treepanel.setXdistance((treepanel.getXdistance() * factor)); treepanel.setXcorrectionFactor((treepanel.getXcorrectionFactor() * x_correction_factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount()); } treepanel.resetPreferredSize(); treepanel.updateOvSizes(); }
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomOutX(final float factor, final float x_correction_factor) { final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(1f);//w w w . j av a 2 s .c o m if ((treepanel.getXdistance() * factor) > 0.0) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar(); if ((treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR) || (treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) || isDrawPhylogram(getMainPanel().getCurrentTabIndex()) || (getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP)) { getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setXdistance((treepanel.getXdistance() * factor)); treepanel.setXcorrectionFactor((treepanel.getXcorrectionFactor() * x_correction_factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(ForesterUtil .roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); } else { final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue(); treepanel.setXdistance(treepanel.getXdistance() * factor); treepanel.setXcorrectionFactor(treepanel.getXcorrectionFactor() * x_correction_factor); if (x > 0) { getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount()); } } treepanel.resetPreferredSize(); treepanel.updateOvSizes(); } }
From source file:org.nuclos.client.ui.collect.result.SearchResultStrategy.java
private void adjustVerticalScrollBarForSearch(boolean bRefreshOnly) { final CollectController<Clct> cc = getCollectController(); final JViewport viewport = cc.getResultPanel().getResultTableScrollPane().getViewport(); if (bRefreshOnly) { final Rectangle rect = cc.getResultTable().getCellRect(0, 0, true); final Rectangle viewRect = viewport.getViewRect(); // There seem to be different opinions about what scrollRectToVisible has to do at SUN and everywhere else... rect.setLocation(viewRect.x, viewRect.y);//rect.x - viewRect.x, rect.y - viewRect.y); viewport.scrollRectToVisible(rect); } else {//from w w w . j a v a 2s.c om Point viewPosition = viewport.getViewPosition(); viewport.setViewPosition(new Point(viewPosition.x, 0)); } final JScrollBar scrlbarVertical = cc.getResultPanel().getResultTableScrollPane().getVerticalScrollBar(); scrlbarVertical.setValue(scrlbarVertical.getMinimum()); }