当前位置: 首页>>代码示例>>Java>>正文


Java JScrollBar.getModel方法代码示例

本文整理汇总了Java中javax.swing.JScrollBar.getModel方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollBar.getModel方法的具体用法?Java JScrollBar.getModel怎么用?Java JScrollBar.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JScrollBar的用法示例。


在下文中一共展示了JScrollBar.getModel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: maintainScrollBar

import javax.swing.JScrollBar; //导入方法依赖的package包/类
/**
 *
 */
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);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:19,代码来源:mxGraphComponent.java

示例2: scrollToCenter

import javax.swing.JScrollBar; //导入方法依赖的package包/类
/**
 * 
 */
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);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:17,代码来源:mxGraphComponent.java

示例3: maintainScrollBar

import javax.swing.JScrollBar; //导入方法依赖的package包/类
/**
 *
 */
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);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:mxGraphComponent.java

示例4: scrollToCenter

import javax.swing.JScrollBar; //导入方法依赖的package包/类
/**
 * 
 */
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);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:mxGraphComponent.java

示例5: checkScrollBar

import javax.swing.JScrollBar; //导入方法依赖的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


注:本文中的javax.swing.JScrollBar.getModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。