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


Java JScrollBar.getVisibleAmount方法代码示例

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


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

示例1: adjustmentValueChanged

import javax.swing.JScrollBar; //导入方法依赖的package包/类
/**
 * Listens to changes of the scroll bar of the text are showing the EULA text, enables the check
 * box once the user scrolled to the end of the document.
 */
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
	JScrollBar scrollBar = this.scrollPane.getVerticalScrollBar();
	if (e.getSource() == scrollBar) {
		// the maximum value of the scroll bar assumes that the content is
		// not visible anymore, since this is not the case when scrolling
		// to the end of the document (the last part is still visible),
		// we have to include the visible amount in the comparison
		int currentValue = scrollBar.getValue() + scrollBar.getVisibleAmount();
		if (currentValue >= scrollBar.getMaximum()) {
			// the user scrolled to the end of the document
			this.acceptCheckBox.setEnabled(true);
			this.acceptCheckBox.requestFocusInWindow();
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:EULADialog.java

示例2: validateThird

import javax.swing.JScrollBar; //导入方法依赖的package包/类
public void validateThird() {
    JViewport viewport = this.pane.getViewport();
    JScrollBar scroller = this.pane.getHorizontalScrollBar();
    if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) {
        throw new Error("unexpected component orientation");
    }
    int value = scroller.getValue();
    if (value != 0) {
        throw new Error("unexpected scroll value");
    }
    int extent = viewport.getExtentSize().width;
    if (extent != scroller.getVisibleAmount()) {
        throw new Error("unexpected visible amount");
    }
    int size = viewport.getViewSize().width;
    if (size != scroller.getMaximum()) {
        throw new Error("unexpected maximum");
    }
    int pos = size - extent - value;
    if (pos != viewport.getViewPosition().x) {
        throw new Error("unexpected position");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:Test6526631.java


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