List of usage examples for javax.swing BoundedRangeModel getMinimum
int getMinimum();
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); System.out.println(model.getMinimum()); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200);/*ww w .j a va2 s . co m*/ frame.setVisible(true); }
From source file:Sketch.java
protected void init(BoundedRangeModel m) { setModel(m);/*from w ww.j ava 2 s . co m*/ valuePerRevolution = m.getMaximum() - m.getMinimum(); setMinimumSize(new Dimension(80, 80)); setPreferredSize(new Dimension(80, 80)); updateUI(); }
From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java
private void recalcScrollBar(Plot plot) { if (plot instanceof XYPlot) { XYPlot hvp = (XYPlot) plot;//ww w . ja v a 2s .c o m ValueAxis axis = hvp.getDomainAxis(); axis.setLowerMargin(0); axis.setUpperMargin(0); Range rng = axis.getRange(); BoundedRangeModel scrollBarModel = this.chartScrollBar.getModel(); int len = scrollBarModel.getMaximum() - scrollBarModel.getMinimum(); if (rng.getLength() > 0) { scrollFactor = len / rng.getLength(); } double dblow = rng.getLowerBound(); int ilow = (int) (dblow * scrollFactor); scrollBarModel.setMinimum(ilow); int val = ilow; scrollBarModel.setValue(val); double dbup = rng.getUpperBound(); int iup = (int) (dbup * scrollFactor); scrollBarModel.setMaximum(iup); int ext = iup - ilow; scrollBarModel.setExtent(ext); scrollBarModel.addChangeListener(this); } }
From source file:apidemo.PanScrollZoomDemo.java
/** * Recalculates the scrollbar settings./*from ww w . j av a2 s . c o m*/ * * @param plot the plot. */ private void recalcScrollBar(final Plot plot) { if (plot instanceof XYPlot) { final XYPlot hvp = (XYPlot) plot; final ValueAxis axis = hvp.getDomainAxis(); axis.setLowerMargin(0); axis.setUpperMargin(0); final Range rng = axis.getRange(); final BoundedRangeModel scrollBarModel = this.scrollBar.getModel(); final int len = scrollBarModel.getMaximum() - scrollBarModel.getMinimum(); if (rng.getLength() > 0) { this.scrollFactor = len / rng.getLength(); } final double dblow = rng.getLowerBound(); final int ilow = (int) (dblow * this.scrollFactor); scrollBarModel.setMinimum(ilow); final int val = ilow; scrollBarModel.setValue(val); final double dbup = rng.getUpperBound(); final int iup = (int) (dbup * this.scrollFactor); scrollBarModel.setMaximum(iup); final int ext = iup - ilow; scrollBarModel.setExtent(ext); scrollBarModel.addChangeListener(this); } }
From source file:org.jcurl.zui.piccolo.BroomPromptSimple.java
private int ratio2value(final double ra, final BoundedRangeModel r) { return r.getMaximum() + (int) ((r.getMinimum() - r.getMaximum()) * ra); }