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


Java JTree.getRowBounds方法代码示例

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


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

示例1: storeScrollPosition

import javax.swing.JTree; //导入方法依赖的package包/类
/**
 * Store first visible node and its offset. Called when the view is scrolled
 * by the user.
 */
private void storeScrollPosition() {
    JTree tree = getJTree();
    if (tree != null) {
        int scrollTop = mainScrollPane.getViewport().getViewPosition().y;
        int row = tree.getClosestRowForLocation(tree.getRowBounds(0).x + 1,
                scrollTop);
        if (row >= 0) {
            TreePath path = tree.getPathForRow(row);
            if (path != null) {
                int offset = tree.getRowBounds(row).y - scrollTop;
                visibleTreePosition = new VisibleTreePosition(
                        path, offset);
                return;
            }
        } else {
            return;
        }
    }
    visibleTreePosition = null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DebuggingViewComponent.java

示例2: restoreScrollPosition

import javax.swing.JTree; //导入方法依赖的package包/类
/**
 * Restore stored scroll position.
 */
private void restoreScrollPosition(boolean delayScrollWithMarkingDirtyRegion) {
    if (visibleTreePosition != null) {
        JTree tree = getJTree();
        if (tree != null) {
            int row = tree.getRowForPath(visibleTreePosition.getPath());
            if (row != -1) {
                Rectangle bounds = tree.getRowBounds(row);
                if (bounds != null) {
                    int scrollY = bounds.y - visibleTreePosition.getOffset();
                    JViewport viewport = mainScrollPane.getViewport();
                    Rectangle rect = viewport.getViewRect();
                    rect.y = scrollY;
                    if (!rect.isEmpty()) {
                        JComponent view = (JComponent) viewport.getView();
                        if (delayScrollWithMarkingDirtyRegion) {
                            RepaintManager.currentManager(viewport).addDirtyRegion(
                                    view,
                                    rect.x, rect.x, rect.width, rect.height);
                        }
                        ignoreScrollAdjustment = true;
                        try {
                            view.scrollRectToVisible(
                                    rect);
                        } finally {
                            ignoreScrollAdjustment = false;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:DebuggingViewComponent.java

示例3: getCellBounds

import javax.swing.JTree; //导入方法依赖的package包/类
private Rectangle getCellBounds() {
    Callable<Rectangle> x = new Callable<Rectangle>() {
        @Override public Rectangle call() {
            JTree tree = (JTree) parent.getComponent();
            return tree.getRowBounds(viewRow);
        }
    };
    try {
        return EventQueueWait.exec(x);
    } catch (Exception e) {
        return new Rectangle();
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JTreeNodeJavaElement.java

示例4: isVisible

import javax.swing.JTree; //导入方法依赖的package包/类
private boolean isVisible(JTree tree, int row) {
    Rectangle visibleRect = tree.getVisibleRect();
    Rectangle cellRect = tree.getRowBounds(row);
    return SwingUtilities.isRectangleContainingRectangle(visibleRect, cellRect);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:6,代码来源:JTreeNodeJavaElement.java


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