當前位置: 首頁>>代碼示例>>Java>>正文


Java BoundedRangeModel.getValue方法代碼示例

本文整理匯總了Java中javax.swing.BoundedRangeModel.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java BoundedRangeModel.getValue方法的具體用法?Java BoundedRangeModel.getValue怎麽用?Java BoundedRangeModel.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.BoundedRangeModel的用法示例。


在下文中一共展示了BoundedRangeModel.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stateChanged

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public void stateChanged(ChangeEvent e) {
    if (e.getSource() == scalesp) {
        scale = ((Number) scalesp.getValue()).doubleValue() * INITIAL_SCALE;
        repaint();
    }
    else if (e.getSource() == hsb.getModel()) {
        BoundedRangeModel m = hsb.getModel();
        if (offset != m.getValue()) {
   	        offset = m.getValue();
   	        repaint();
        }
    }
    else if (e.getSource() == csp.getVerticalScrollBar().getModel()) {
        if (scrollVerticallyOnNextUpdate) {
            scrollVerticallyOnNextUpdate = false;
            csp.getVerticalScrollBar().getModel().setValue(Integer.MAX_VALUE);
        }
    }
}
 
開發者ID:swift-lang,項目名稱:swift-k,代碼行數:20,代碼來源:GanttChart.java

示例2: scrollRectToVisible

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
/**
 * Horizontally scrolls text to make specified rectangle
 * visible. Uses bounded range model value for
 * scrolling. Repaints TextField.
 */
@Override
void scrollRectToVisible(Rectangle r) {
    final int x = r.x;
    final Insets insets = getTextFieldKit().getInsets();
    final BoundedRangeModel brm = getTextFieldKit().getHorizontalVisibility();
    final int oldValue = brm.getValue();
    final int width = getModelRect().width;
    if (x > width - insets.right) {
        final int newVal = oldValue + (x - width + insets.right) + 2;
        brm.setValue(newVal);
        repaint();
    }
    if (x < insets.left) {
        brm.setValue(oldValue - (insets.left - x) - 2);
        repaint();
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:23,代碼來源:TextField.java

示例3: calculateThumbBounds

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
void calculateThumbBounds(final BoundedRangeModel model) {
    int extent = model.getExtent();
    int viewSize = model.getMaximum() - model.getMinimum();
    if (viewSize == 0) {
        setThumbBounds(0, 0, 0, 0);
        return;
    }
    int proposedThumbSize = (int)((float)getTrackSize() * extent / viewSize);
    int thumbSize = getThumbSize(proposedThumbSize);
    int availableTrackSize = getTrackSize() - thumbSize;
    if (availableTrackSize <= 0) {
        if (proposedThumbSize == thumbSize) {
            Rectangle trackBounds = getTrackBounds();
            setThumbBounds(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
        } else {
            setThumbBounds(0, 0, 0, 0);
        }
    } else {
        int availableScrollingSize = viewSize - extent;
        int offset = (availableScrollingSize > 0 ? availableTrackSize * model.getValue() / availableScrollingSize : 0) + getButtonSize(decrButton);
        Rectangle newThumbBounds = newThumbBounds(offset, thumbSize);
        setThumbBounds(newThumbBounds.x, newThumbBounds.y, newThumbBounds.width, newThumbBounds.height);
        trackListener.offset = offset;
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:26,代碼來源:BasicScrollBarUI.java

示例4: scrollRectToVisible

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
/**
 * Horizontally scrolls text to make specified rectangle
 * visible. Uses bounded range model value for
 * scrolling. Repaints TextField.
 */
@Override
void scrollRectToVisible(Rectangle r) {
    int x = r.x;
    Insets insets = getTextFieldKit().getInsets();
    BoundedRangeModel brm = getTextFieldKit().getHorizontalVisibility();
    int oldValue = brm.getValue();
    int width = getModelRect().width;
    if (x > width - insets.right) {
        int newVal = oldValue + (x - width + insets.right) + 2;
        brm.setValue(newVal);
        repaint();
    }
    if (x < insets.left) {
        brm.setValue(oldValue - (insets.left - x) - 2);
        repaint();
    }
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:23,代碼來源:TextField.java

示例5: componentResized

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
@Override
     public void componentResized(ComponentEvent event) {
boolean adjustViewportToBottom = false;

BoundedRangeModel model = scrollBar.getModel();
if ((model.getValue() == model.getMaximum() - model.getExtent())
		|| model.getExtent() >= model.getMaximum()) {
	adjustViewportToBottom = true;
}

model.setExtent(viewport.getHeight());
model.setMaximum(viewport.getView().getHeight());

if (adjustViewportToBottom || !isActive) {
	model.setValue(viewport.getView().getHeight() - viewport.getHeight());
}
     }
 
開發者ID:georgy,項目名稱:gmc,代碼行數:18,代碼來源:SplitTextPane.java

示例6: checkScrollBar

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
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 scrollBarModel = scrollBar.getModel();
    int value = scrollBarModel.getValue();
    int extent = scrollBarModel.getExtent();
    int maximum = scrollBarModel.getMaximum();

    boolean valueChanged = previousScrollBarValue != value;
    boolean maximumChanged = previousScrollBarMaximum != maximum;

    //  Check if the user has manually repositioned the scrollbar
    if (valueChanged && !maximumChanged) {
        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) {
        //  Scroll the viewport to the end.
        scrollBar.removeAdjustmentListener(scrollBarAdjustmentListener);
        value = maximum - extent;
        scrollBar.setValue(value);
        scrollBar.addAdjustmentListener(scrollBarAdjustmentListener);
    }

    previousScrollBarValue = value;
    previousScrollBarMaximum = maximum;
}
 
開發者ID:chipKIT32,項目名稱:chipKIT-importer,代碼行數:33,代碼來源:SerialMonitorDisplayPane.java

示例7: copy

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
private DefaultBoundedRangeModel copy (BoundedRangeModel m)
{
    return new DefaultBoundedRangeModel(
            m.getValue(),
            m.getExtent(),
            m.getMinimum(),
            m.getMaximum());
}
 
開發者ID:Audiveris,項目名稱:audiveris,代碼行數:9,代碼來源:SheetAssembly.java

示例8: paintDeterminate

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
/**
 * @param g
 */
private void paintDeterminate(final Graphics g) {
    final BoundedRangeModel model = circleBar.getModel();
    final double progress = model.getValue() / (double) model.getMaximum();

    this.paint(g, progress, circleBar.getNonvalueClipPainter(), circleBar.getValueClipPainter());

}
 
開發者ID:friedlwo,項目名稱:AppWoksUtils,代碼行數:11,代碼來源:BasicCircleProgressBarUI.java

示例9: hsbStateChanged

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
private void hsbStateChanged(JViewport viewport, ChangeEvent e) {
    BoundedRangeModel model = (BoundedRangeModel) (e.getSource());
    Point p = viewport.getViewPosition();
    int value = model.getValue();
    if (scrollpane.getComponentOrientation().isLeftToRight()) {
        p.x = value;
    } else {
        int max = viewport.getViewSize().width;
        int extent = viewport.getExtentSize().width;
        int oldX = p.x;

        /*
         * Set new X coordinate based on "value".
         */
        p.x = max - extent - value;

        /*
         * If setValue() was called before "extent" was fixed, turn
         * setValueCalled flag on.
         */
        if ((extent == 0) && (value != 0) && (oldX == max)) {
            setValueCalled = true;
        } else {
            /*
             * When a pane without a horizontal scroll bar was reduced
             * and the bar appeared, the viewport should show the right
             * side of the view.
             */
            if ((extent != 0) && (oldX < 0) && (p.x == 0)) {
                p.x += value;
            }
        }
    }
    viewport.setViewPosition(p);
}
 
開發者ID:khuxtable,項目名稱:seaglass,代碼行數:36,代碼來源:SeaGlassScrollPaneUI.java

示例10: addJob

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
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());
}
 
開發者ID:swift-lang,項目名稱:swift-k,代碼行數:13,代碼來源:GanttChart.java

示例11: adjustmentValueChanged

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public void adjustmentValueChanged(AdjustmentEvent e) {
    JScrollBar sb = (JScrollBar)e.getSource();
    BoundedRangeModel m = sb.getModel();
    int vval = m.getValue();
    float dv = previous - vval;
    previous = vval;
    if(dv != 0 && scrollBarsMayControlAdjusting) {
    
        // get the uniform scale of all transforms
        float layoutScale = (float) vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).getScale();
        dv *= layoutScale;
        AffineTransform at = AffineTransform.getTranslateInstance(0, dv);
        vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).preConcatenate(at);
    }
}
 
開發者ID:SiLeBAT,項目名稱:BfROpenLab,代碼行數:16,代碼來源:GraphZoomScrollPane.java

示例12: adjustmentValueChanged

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public void adjustmentValueChanged(AdjustmentEvent e) {
    JScrollBar sb = (JScrollBar)e.getSource();
    BoundedRangeModel m = sb.getModel();
    int vval = m.getValue();
    float dv = previous - vval;
    previous = vval;
    if(dv != 0 && scrollBarsMayControlAdjusting) {
        // get the uniform scale of all transforms
        float layoutScale = (float) vv.getLayoutTransformer().getScale();
        dv *= layoutScale;
        AffineTransform at = AffineTransform.getTranslateInstance(0, dv);
        vv.getLayoutTransformer().preConcatenate(at);
    }
}
 
開發者ID:markus1978,項目名稱:clickwatch,代碼行數:15,代碼來源:GraphZoomScrollPane.java

示例13: getMoveCameraToPoint

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public static Point getMoveCameraToPoint(final ClassView cv, final double zoom, final JScrollPane pane) {
	final Point2D centre = cv.getCentre();
	final JScrollBar vertSB  = pane.getVerticalScrollBar();
	final JScrollBar horizSB = pane.getHorizontalScrollBar();
	Point pt = new Point();
	
	BoundedRangeModel model = vertSB.getModel();
	int value	= model.getValue();
	final int cy 	= pane.getHeight()/2 + value;
	int newValue 	= value+(int)(centre.getY()*zoom)-cy;

	if(newValue>model.getMaximum())
		newValue = model.getMaximum();
	else if(newValue<model.getMinimum())
		newValue = model.getMinimum();

	pt.y = newValue;

	model = horizSB.getModel();
	value	= model.getValue();
	final int cx 	= pane.getWidth()/2 + value;
	newValue 	= value+(int)(centre.getX()*zoom)-cx;

	if(newValue>model.getMaximum())
		newValue = model.getMaximum();
	else if(newValue<model.getMinimum())
		newValue = model.getMinimum();
	
	pt.x = newValue;
	
	return pt;
}
 
開發者ID:arnobl,項目名稱:kompren,代碼行數:33,代碼來源:Completioner.java

示例14: isVisibleRow

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
private boolean isVisibleRow(JTable table, int row) {
    JScrollBar vScroll = getVerticalScrollBar(table);
    if (vScroll == null) {
        return true;
    }
    BoundedRangeModel model = vScroll.getModel();
    int rowHeight = table.getRowHeight() * row - model.getValue();
    return 0 <= rowHeight && rowHeight < model.getExtent();
}
 
開發者ID:montsuqi,項目名稱:monsiaj,代碼行數:10,代碼來源:CListHandler.java

示例15: isScrollBarFullyExtended

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public static boolean isScrollBarFullyExtended(JScrollBar vScrollBar) {
      BoundedRangeModel model = vScrollBar.getModel();
int bottomPos = model.getExtent() + model.getValue() + 10;
int maxPos = model.getMaximum();
      return bottomPos >= maxPos;
  }
 
開發者ID:Ch3ck,項目名稱:ramaTiNuP,代碼行數:7,代碼來源:ChatWindow.java


注:本文中的javax.swing.BoundedRangeModel.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。