FileDocCategorySizeDatePackage
WindowsTreeUI.javaAPI DocJava SE 5 API5896Fri Aug 26 14:54:50 BST 2005com.sun.java.swing.plaf.windows

WindowsTreeUI

public class WindowsTreeUI extends BasicTreeUI
A Windows tree.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

version
1.23 12/19/03
author
Scott Violet

Fields Summary
protected static final int
HALF_SIZE
protected static final int
SIZE
Constructors Summary
Methods Summary
protected javax.swing.tree.TreeCellRenderercreateDefaultCellRenderer()
Returns the default cell renderer that is used to do the stamping of each node.


                        
       
	return new WindowsTreeCellRenderer();
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)

	return new WindowsTreeUI();
      
protected voidensureRowsAreVisible(int beginRow, int endRow)
Ensures that the rows identified by beginRow through endRow are visible.

	if(tree != null && beginRow >= 0 && endRow < getRowCount(tree)) {
            Rectangle visRect = tree.getVisibleRect();
	    if(beginRow == endRow) {
		Rectangle     scrollBounds = getPathBounds(tree, getPathForRow
							   (tree, beginRow));

		if(scrollBounds != null) {
                    scrollBounds.x = visRect.x;
                    scrollBounds.width = visRect.width;
		    tree.scrollRectToVisible(scrollBounds);
		}
	    }
	    else {
		Rectangle   beginRect = getPathBounds(tree, getPathForRow
						      (tree, beginRow));
		Rectangle   testRect = beginRect;
		int         beginY = beginRect.y;
		int         maxY = beginY + visRect.height;

		for(int counter = beginRow + 1; counter <= endRow; counter++) {
		    testRect = getPathBounds(tree,
					     getPathForRow(tree, counter));
		    if((testRect.y + testRect.height) > maxY)
			counter = endRow;
		}
		tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1,
						  testRect.y + testRect.height-
						  beginY));
	    }
	}