/** * */ 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); } }
graphComponent.getHorizontalScrollBar().setValue( graphComponent.getHorizontalScrollBar().getValue() + dx); graphComponent.getVerticalScrollBar().setValue(
/** * */ 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); } }
graphComponent.getHorizontalScrollBar().setValue( graphComponent.getHorizontalScrollBar().getValue() + dx); graphComponent.getVerticalScrollBar().setValue(
/** * */ public Point convertPoint(Point pt) { pt = SwingUtilities.convertPoint(graphComponent, pt, graphComponent.getGraphControl()); pt.x -= graphComponent.getHorizontalScrollBar().getValue(); pt.y -= graphComponent.getVerticalScrollBar().getValue(); return pt; }
/** * */ public Point convertPoint(Point pt) { pt = SwingUtilities.convertPoint(graphComponent, pt, graphComponent.getGraphControl()); pt.x -= graphComponent.getHorizontalScrollBar().getValue(); pt.y -= graphComponent.getVerticalScrollBar().getValue(); return pt; }
/** * */ public void scrollToCenter(boolean horizontal) { JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar() : getVerticalScrollBar(); if (scrollBar != null) { final BoundedRangeModel model = scrollBar.getModel(); final int newValue = ((model.getMaximum()) / 2) - model.getExtent() / 2; model.setValue(newValue); } }
/** * */ public void scrollToCenter(boolean horizontal) { JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar() : getVerticalScrollBar(); if (scrollBar != null) { final BoundedRangeModel model = scrollBar.getModel(); final int newValue = ((model.getMaximum()) / 2) - model.getExtent() / 2; model.setValue(newValue); } }
&& graphComponent.getHorizontalScrollBar().isVisible() && graphComponent.getVerticalScrollBar().isVisible(); double graphScale = graphComponent.getGraph().getView()
&& graphComponent.getHorizontalScrollBar().isVisible() && graphComponent.getVerticalScrollBar().isVisible(); double graphScale = graphComponent.getGraph().getView()
public void run() { Dimension pageSize = getPreferredSizeForPage(); if (getViewport().getWidth() > pageSize.getWidth()) { scrollToCenter(true); } else { JScrollBar scrollBar = getHorizontalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 3) - 4); } } if (getViewport().getHeight() > pageSize.getHeight()) { scrollToCenter(false); } else { JScrollBar scrollBar = getVerticalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 4) - 4); } } } });
public void run() { Dimension pageSize = getPreferredSizeForPage(); if (getViewport().getWidth() > pageSize.getWidth()) { scrollToCenter(true); } else { JScrollBar scrollBar = getHorizontalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 3) - 4); } } if (getViewport().getHeight() > pageSize.getHeight()) { scrollToCenter(false); } else { JScrollBar scrollBar = getVerticalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 4) - 4); } } } });
.getHorizontalScrollBar(); final double sx;
.getHorizontalScrollBar(); final double sx;
double rat = scale / oldscale; JScrollBar vbar = gc.getVerticalScrollBar(); JScrollBar hbar = gc.getHorizontalScrollBar();
this.graphComponent.getGraphControl().removeComponentListener( componentHandler); this.graphComponent.getHorizontalScrollBar() .removeAdjustmentListener(adjustmentHandler); this.graphComponent.getVerticalScrollBar() this.graphComponent.getGraphControl().addComponentListener( componentHandler); this.graphComponent.getHorizontalScrollBar().addAdjustmentListener( adjustmentHandler); this.graphComponent.getVerticalScrollBar().addAdjustmentListener(
this.graphComponent.getGraphControl().removeComponentListener( componentHandler); this.graphComponent.getHorizontalScrollBar() .removeAdjustmentListener(adjustmentHandler); this.graphComponent.getVerticalScrollBar() this.graphComponent.getGraphControl().addComponentListener( componentHandler); this.graphComponent.getHorizontalScrollBar().addAdjustmentListener( adjustmentHandler); this.graphComponent.getVerticalScrollBar().addAdjustmentListener(
int x = e.getX() - modelcontainer.getGraphComponent().getHorizontalScrollBar().getModel().getValue(); int y = e.getY() - modelcontainer.getGraphComponent().getVerticalScrollBar().getModel().getValue(); gcm.show(modelcontainer.getGraphComponent(), x, y); int x = e.getX() - modelcontainer.getGraphComponent().getHorizontalScrollBar().getModel().getValue(); int y = e.getY() - modelcontainer.getGraphComponent().getVerticalScrollBar().getModel().getValue(); ecm.show(modelcontainer.getGraphComponent(), x, y);
actionlistener); edcmc[0] = edcm; int x = e.getX() - graphComponent.getHorizontalScrollBar().getModel().getValue(); int y = e.getY() - graphComponent.getVerticalScrollBar().getModel().getValue(); edcm.show(graphComponent, x, y);