Java Code Examples for javax.swing.BoundedRangeModel#getMaximum()
The following examples show how to use
javax.swing.BoundedRangeModel#getMaximum() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: mxGraphComponent.java From blog-codes with Apache License 2.0 | 5 votes |
/** * */ 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); } }
Example 2
Source File: SheetAssembly.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
private DefaultBoundedRangeModel copy (BoundedRangeModel m) { return new DefaultBoundedRangeModel( m.getValue(), m.getExtent(), m.getMinimum(), m.getMaximum()); }
Example 3
Source File: GanttChart.java From swift-k with Apache License 2.0 | 5 votes |
protected void addJob(ApplicationItem ai) { Job j = new Job(ai); j.start(); jobmap.put(ai.getID(), j); jobs.add(j); BoundedRangeModel m = csp.getVerticalScrollBar().getModel(); if (m.getValue() + m.getExtent() == m.getMaximum()) { scrollVerticallyOnNextUpdate = true; } hmodel.fireTableRowsInserted(jobs.size(), jobs.size()); cmodel.fireTableRowsInserted(jobs.size(), jobs.size()); }
Example 4
Source File: SmartScroller.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private void checkScrollBar(AdjustmentEvent e) { // The scroll bar listModel contains information needed to determine // whether the viewport should be repositioned or not. JScrollBar scrollBar = (JScrollBar)e.getSource(); BoundedRangeModel listModel = scrollBar.getModel(); int value = listModel.getValue(); int extent = listModel.getExtent(); int maximum = listModel.getMaximum(); boolean valueChanged = previousValue != value; boolean maximumChanged = previousMaximum != maximum; // Check if the user has manually repositioned the scrollbar if (valueChanged && !maximumChanged) { if (viewportPosition == START) adjustScrollBar = value != 0; else adjustScrollBar = value + extent >= maximum; } // Reset the "value" so we can reposition the viewport and // distinguish between a user scroll and a program scroll. // (ie. valueChanged will be false on a program scroll) if (adjustScrollBar && viewportPosition == END) { // Scroll the viewport to the end. scrollBar.removeAdjustmentListener( this ); value = maximum - extent; scrollBar.setValue( value ); scrollBar.addAdjustmentListener( this ); } if (adjustScrollBar && viewportPosition == START) { // Keep the viewport at the same relative viewportPosition scrollBar.removeAdjustmentListener( this ); value = value + maximum - previousMaximum; scrollBar.setValue( value ); scrollBar.addAdjustmentListener( this ); } previousValue = value; previousMaximum = maximum; }