當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。