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


Java JViewport.addChangeListener方法代码示例

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


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

示例1: computeVisibleSpan

import javax.swing.JViewport; //导入方法依赖的package包/类
private int[] computeVisibleSpan() {
    Component parent = pane.getParent();
    
    if (parent instanceof JLayeredPane) {
        parent = parent.getParent();
    }

    if (parent instanceof JViewport) {
        JViewport vp = (JViewport) parent;

        Point start = vp.getViewPosition();
        Dimension size = vp.getExtentSize();
        Point end = new Point((int) (start.getX() + size.getWidth()), (int) (start.getY() + size.getHeight()));

        int startPosition = pane.viewToModel(start);
        int endPosition = pane.viewToModel(end);

        if (parentWithListener != vp) {
            vp.addChangeListener(WeakListeners.change(this, vp));
            parentWithListener = vp;
        }
        return new int[] {startPosition, endPosition};
    }

    return new int[] {0, pane.getDocument().getLength()};
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ComponentPeer.java

示例2: addViewportListener

import javax.swing.JViewport; //导入方法依赖的package包/类
private void addViewportListener(JEditorPane pane) {
    Container parent = pane.getParent();
    
    if (parent instanceof JLayeredPane) {
        parent = parent.getParent();
    }

    if (parent instanceof JViewport) {
        JViewport viewport = (JViewport) parent;

        viewport.addChangeListener(WeakListeners.change(AnnotationHolder.this, viewport));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:AnnotationHolder.java

示例3: configureEnclosingScrollPane

import javax.swing.JViewport; //导入方法依赖的package包/类
/**
 * duplicated to avoid repeating the same checks multiple times
 */
@Override
protected void configureEnclosingScrollPane() {
	Container p = getParent();
	if (p instanceof JViewport) {
		Container gp = p.getParent();
		if (gp instanceof JScrollPane) {
			JScrollPane scrollPane = (JScrollPane) gp;
			// Make certain we are the viewPort's view and not, for
			// example, the rowHeaderView of the scrollPane -
			// an implementor of fixed columns might do this.
			JViewport viewport = scrollPane.getViewport();
			if (viewport == null || viewport.getView() != this) {
				return;
			}
			scrollPane.setColumnHeaderView(getTableHeader());
			Border border = scrollPane.getBorder();
			if (border == null || border instanceof UIResource) {
				scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
			}
			//rowHeader=new RowHeader(dataModel);
			rowHeader.setRowHeight(CommonConstants.ROW_HEIGHT);
			rowHeader.install(this, scrollPane);
			installLabels(scrollPane);
			installSelectAllButton(scrollPane);
			viewport.addChangeListener(scrollListener);
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:32,代码来源:ExactTable.java

示例4: addNotify

import javax.swing.JViewport; //导入方法依赖的package包/类
@Override
public void addNotify() {
    super.addNotify();

    Component c = getParent();

    //  Keep scrolling of the row table in sync with the main table.
    if (c instanceof JViewport) {
        JViewport viewport = (JViewport) c;
        viewport.addChangeListener(this);
    }
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:13,代码来源:Table.java

示例5: configureEnclosingScrollPane

import javax.swing.JViewport; //导入方法依赖的package包/类
/**
 * duplicated to avoid repeating the same checks multiple times
 */
@Override
protected void configureEnclosingScrollPane() {
	Container p = getParent();
	if (p instanceof JViewport) {
		Container gp = p.getParent();
		if (gp instanceof JScrollPane) {
			JScrollPane scrollPane = (JScrollPane) gp;
			// Make certain we are the viewPort's view and not, for
			// example, the rowHeaderView of the scrollPane -
			// an implementor of fixed columns might do this.
			JViewport viewport = scrollPane.getViewport();
			if (viewport == null || viewport.getView() != this) {
				return;
			}
			scrollPane.setColumnHeaderView(getTableHeader());
			Border border = scrollPane.getBorder();
			if (border == null || border instanceof UIResource) {
				scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
			}
			//rowHeader=new RowHeader(dataModel);
			rowHeader.install(this, scrollPane);
			installLabels(scrollPane);
			installSelectAllButton(scrollPane);
			viewport.addChangeListener(scrollListener);
		}
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:31,代码来源:ExactTable.java

示例6: subscribeActual

import javax.swing.JViewport; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super ChangeEvent> observer) {
    JViewport w = widget;

    ChangeEventConsumer aec = new ChangeEventConsumer(observer, w);
    observer.onSubscribe(aec);

    w.addChangeListener(aec);
    if (aec.get() == null) {
        aec.onDispose(w);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:13,代码来源:ChangeEventViewportObservable.java


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