所有类


javax.swing.plaf.basic
类 BasicTreeUI

java.lang.Object
  继承者 javax.swing.plaf.ComponentUI
      继承者 javax.swing.plaf.TreeUI
          继承者 javax.swing.plaf.basic.BasicTreeUI
直接已知子类:
MetalTreeUI

public class BasicTreeUI
   
   
   
   
extends TreeUI

层次数据结构的基本 L&F。


嵌套类摘要
 classBasicTreeUI.CellEditorHandler
          侦听器负责获取单元格编辑事件并相应地更新树。
 classBasicTreeUI.ComponentHandler
          滚动时更新首选大小(如果需要)。
 classBasicTreeUI.FocusHandler
          失去/获得焦点时重绘前导选择行。
 classBasicTreeUI.KeyHandler
          用于获取多个按键事件以适当生成事件。
 classBasicTreeUI.MouseHandler
          TreeMouseListener 负责基于鼠标事件更新选择。
 classBasicTreeUI.MouseInputHandler
          在将鼠标释放到用于构造 MouseInputHandler 的目的地之前,它一直负责传递所有鼠标事件,包括鼠标移动事件。
 classBasicTreeUI.NodeDimensionsHandler
          负责获取节点大小的类,其方法被转发到 BasicTreeUI 方法。
 classBasicTreeUI.PropertyChangeHandler
          树的 PropertyChangeListener。
 classBasicTreeUI.SelectionModelPropertyChangeHandler
          TreeSelectionModel 上的侦听器,如果模型的任何属性发生更改,则重置行选择。
 classBasicTreeUI.TreeCancelEditingAction
          执行操作时调用 cancelEditing 的 ActionListener。
 classBasicTreeUI.TreeExpansionHandler
          更新 TreeState 以响应节点的展开/折叠。
 classBasicTreeUI.TreeHomeAction
          TreeHomeAction 用于处理 end/home 动作。
 classBasicTreeUI.TreeIncrementAction
          TreeIncrementAction 用于处理向上/向下操作。
 classBasicTreeUI.TreeModelHandler
          将所有 TreeModel 事件转发到 TreeState。
 classBasicTreeUI.TreePageAction
          TreePageAction 处理向上翻页和向下翻页事件。
 classBasicTreeUI.TreeSelectionHandler
          侦听选择模型中的更改并相应地更新显示。
 classBasicTreeUI.TreeToggleAction
          对于第一个选定行展开将被切换。
 classBasicTreeUI.TreeTraverseAction
          TreeTraverseAction 是用于向左/向右方向键的动作。
 
字段摘要
protected  TreeCellEditorcellEditor
          树的编辑器。
protected  IconcollapsedIcon
           
protected  booleancreatedCellEditor
          如果当前位于树中的编辑器由此实例创建,则设置为 true。
protected  booleancreatedRenderer
          如果当前在树中使用的渲染器由此实例创建,则设置为 true。
protected  TreeCellRenderercurrentCellRenderer
          要用于进行实际单元格绘制的渲染器。
protected  intdepthOffset
          要正确计算 x 位置应该偏移的深度。
protected  Hashtable<TreePath,Boolean>drawingCache
          用于最小化垂直线的绘制。
protected  ComponenteditingComponent
          编辑时,它将是进行实际编辑的 Component。
protected  TreePatheditingPath
          要编辑的路径。
protected  inteditingRow
          要编辑的行。
protected  booleaneditorHasDifferentSize
          如果编辑器的大小不同于渲染器,则设置为 true。
protected  IconexpandedIcon
           
protected  booleanlargeModel
          如果对 largeModel 进行优化,则为 True。
protected  intlastSelectedRow
          上一次选中行的索引。
protected  intleftChildIndent
          从左页边空白到将绘制垂直虚线的位置之间的距离。
protected  AbstractLayoutCache.NodeDimensionsnodeDimensions
          负责告知 TreeState 节点所需的大小。
protected  DimensionpreferredMinSize
          最大首选大小。
protected  DimensionpreferredSize
          完全显示所有节点所需的大小。
protected  CellRendererPanerendererPane
          用于绘制 TreeCellRenderer。
protected  intrightChildIndent
          添加到 leftChildIndent 以确定将绘制单元格内容的位置的距离。
protected  booleanstopEditingInCompleteEditing
          编辑时设置为 false,shouldSelectCell() 返回 true 表示应该在编辑前选中节点,在 completeEditing 中使用该字段。
protected  inttotalChildIndent
          将缩进的总距离。
protected  JTreetree
          要在其中进行绘制的组件。
protected  TreeModeltreeModel
          用于确定要显示的内容。
protected  TreeSelectionModeltreeSelectionModel
          维护选择的模型。
protected  AbstractLayoutCachetreeState
          负责处理大小和展开问题的对象。
protected  booleanvalidCachedPreferredSize
          preferredSize 是否有效?
 
构造方法摘要
BasicTreeUI()
           
 
方法摘要
 voidcancelEditing(JTree tree)
          取消当前编辑会话。
protected  voidcheckForClickInExpandControl(TreePath path, int mouseX, int mouseY)
          如果 mouseXmouseY 位于 row 的展开/折叠区域内,则此方法将切换行。
protected  voidcompleteEditing()
          传递消息以停止编辑会话。
protected  voidcompleteEditing(boolean messageStop, boolean messageCancel, boolean messageTree)
          停止编辑会话。
protected  voidcompleteUIInstall()
          在安装所有默认值/侦听器之后根据 installUI 调用。
protected  voidcompleteUIUninstall()
           
protected  voidconfigureLayoutCache()
          基于为其提供外观的树重置 TreeState 实例。
protected  CellEditorListenercreateCellEditorListener()
          创建在当前编辑器中处理事件的侦听器。
protected  CellRendererPanecreateCellRendererPane()
          返回用于放置渲染器组件的渲染器窗格。
protected  ComponentListenercreateComponentListener()
          创建并返回新的 ComponentHandler。
protected  TreeCellEditorcreateDefaultCellEditor()
          创建默认单元格编辑器。
protected  TreeCellRenderercreateDefaultCellRenderer()
          返回用于为每个节点添加标志的默认单元格渲染器。
protected  FocusListenercreateFocusListener()
          创建失去/获取焦点时负责更新显示的侦听器。
protected  KeyListenercreateKeyListener()
          创建负责从树获取键事件的侦听器。
protected  AbstractLayoutCachecreateLayoutCache()
          创建负责管理展开内容及节点大小的对象。
protected  MouseListenercreateMouseListener()
          创建负责基于鼠标事件更新选择的侦听器。
protected  AbstractLayoutCache.NodeDimensionscreateNodeDimensions()
          创建能够确定树中给定节点大小的 NodeDimensions 的实例。
protected  PropertyChangeListenercreatePropertyChangeListener()
          创建负责基于树的更改方式更新 UI 的侦听器。
protected  PropertyChangeListenercreateSelectionModelPropertyChangeListener()
          创建负责从选择模型获取属性更改事件的侦听器。
protected  TreeExpansionListenercreateTreeExpansionListener()
          创建并返回在节点展开状态更改时负责更新 treestate 的对象。
protected  TreeModelListenercreateTreeModelListener()
          返回可以在模型更改时更新树的侦听器。
protected  TreeSelectionListenercreateTreeSelectionListener()
          创建基于选择更改方法更新显示的侦听器。
static ComponentUIcreateUI(JComponent x)
           
protected  voiddrawCentered(Component c, Graphics graphics, Icon icon, int x, int y)
           
protected  voiddrawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
           
protected  voiddrawDashedVerticalLine(Graphics g, int x, int y1, int y2)
           
protected  voidensureRowsAreVisible(int beginRow, int endRow)
          确保 beginRow 通过 endRow 标识的行是可见的。
protected  TreeCellEditorgetCellEditor()
           
protected  TreeCellRenderergetCellRenderer()
          返回 currentCellRenderer,可以为树渲染器,也可以为 defaultCellRenderer,无论哪个都不为 null。
 TreePathgetClosestPathForLocation(JTree tree, int x, int y)
          返回到达最接近于 x,y 的那个节点的路径。
 IcongetCollapsedIcon()
           
 TreePathgetEditingPath(JTree tree)
          返回到达正被编辑的元素的路径。
 IcongetExpandedIcon()
           
protected  ColorgetHashColor()
           
protected  intgetHorizontalLegBuffer()
          默认情况下,节点间支路的水平元素开始于子节点左侧的右边。
protected  TreePathgetLastChildPath(TreePath parent)
          返回到 parent 的最后一个子节点的路径。
 intgetLeftChildIndent()
           
 DimensiongetMaximumSize(JComponent c)
          返回此组件的最大大小,如果实例当前位于 JTree 中或 0, 0 处,则该大小将为首选大小。
 DimensiongetMinimumSize(JComponent c)
          返回此组件的最小大小。
protected  TreeModelgetModel()
           
 RectanglegetPathBounds(JTree tree, TreePath path)
          返回封闭标签部分的 Rectangle,路径中的最后一个项将在这一部分绘制。
 TreePathgetPathForRow(JTree tree, int row)
          返回传入的 row 的路径。
 DimensiongetPreferredMinSize()
          返回最小首选大小。
 DimensiongetPreferredSize(JComponent c)
          返回首选大小以正确显示树,这是一种 getPreferredSize(c, false) 的替代方法。
 DimensiongetPreferredSize(JComponent c, boolean checkConsistancy)
          返回首选大小以表示 c 中的树。
 intgetRightChildIndent()
           
 intgetRowCount(JTree tree)
          返回将显示的行数。
 intgetRowForPath(JTree tree, TreePath path)
          返回可在其中看见路径中标识的最后一个项的行。
protected  intgetRowHeight()
           
protected  intgetRowX(int row, int depth)
          返回沿 x 轴呈现特定行的位置。
protected  TreeSelectionModelgetSelectionModel()
           
protected  booleangetShowsRootHandles()
           
protected  intgetVerticalLegBuffer()
          默认情况下,节点间支路的垂直元素开始于父节点的底部。
protected  voidhandleExpandControlClick(TreePath path, int mouseX, int mouseY)
          当用户单击特定行时传递消息,此方法调用 toggleExpandState。
protected  voidinstallComponents()
          安装作为渲染器窗格的树的子组件。
protected  voidinstallDefaults()
           
protected  voidinstallKeyboardActions()
           
protected  voidinstallListeners()
           
 voidinstallUI(JComponent c)
          配置指定组件,使其适合外观。
protected  booleanisEditable()
           
 booleanisEditing(JTree tree)
          如果树正被编辑,则返回 true。
protected  booleanisLargeModel()
           
protected  booleanisLeaf(int row)
           
protected  booleanisLocationInExpandControl(TreePath path, int mouseX, int mouseY)
          如果 mouseXmouseY 落在用于展开/折叠节点的行的区域内,并且 row 的节点不表示叶节点,则返回 true。
protected  booleanisMultiSelectEvent(MouseEvent event)
          返回 true 表示节点上的鼠标事件应该根据锚点作出选择。
protected  booleanisRootVisible()
           
protected  booleanisToggleEvent(MouseEvent event)
          返回 true 指示应该基于事件切换鼠标下的行。
protected  booleanisToggleSelectionEvent(MouseEvent event)
          返回 true 表示节点上的鼠标事件应该仅切换鼠标下的行的选择。
 voidpaint(Graphics g, JComponent c)
          绘制指定组件,使其适合外观。
protected  voidpaintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          绘制 row 的展开(切换)部分。
protected  voidpaintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
          绘制水平线。
protected  voidpaintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          绘制支路 (leg) 的水平部分。
protected  voidpaintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          绘制 row 的渲染器部分。
protected  voidpaintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
          绘制垂直线。
protected  voidpaintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
          绘制支路的垂直部分。
protected  voidpathWasCollapsed(TreePath path)
          在折叠 VisibleTreeNode 后,从其传递消息。
protected  voidpathWasExpanded(TreePath path)
          在展开 VisibleTreeNode 后,从其传递消息。
protected  voidprepareForUIInstall()
          在设置 tree 实例变量之后,但在安装任何默认值/侦听器之前调用此方法。
protected  voidprepareForUIUninstall()
           
protected  voidselectPathForEvent(TreePath path, MouseEvent event)
          传递消息以基于特定行上的 MouseEvent 更新选择。
protected  voidsetCellEditor(TreeCellEditor editor)
          设置单元格编辑器。
protected  voidsetCellRenderer(TreeCellRenderer tcr)
          将 TreeCellRenderer 设置为 tcr
 voidsetCollapsedIcon(Icon newG)
           
protected  voidsetEditable(boolean newValue)
          配置接收者以允许或不允许进行编辑。
 voidsetExpandedIcon(Icon newG)
           
protected  voidsetHashColor(Color color)
           
protected  voidsetLargeModel(boolean largeModel)
          如果必要,则更新 componentListener。
 voidsetLeftChildIndent(int newAmount)
           
protected  voidsetModel(TreeModel model)
          设置 TreeModel。
 voidsetPreferredMinSize(Dimension newSize)
          设置首选最小大小。
 voidsetRightChildIndent(int newAmount)
           
protected  voidsetRootVisible(boolean newValue)
          将根设置为可见。
protected  voidsetRowHeight(int rowHeight)
          设置行高度,此方法将被转发到 treeState。
protected  voidsetSelectionModel(TreeSelectionModel newLSM)
          重置选择模型。
protected  voidsetShowsRootHandles(boolean newValue)
          确定是否显示节点句柄。
protected  booleanshouldPaintExpandControl(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          如果应该为指定行绘制展开(切换)控件,则返回 true。
protected  booleanstartEditing(TreePath path, MouseEvent event)
          如果存在 cellEditor 并且 shouldSelectCell 返回 true,则启动节点的编辑操作。
 voidstartEditingAtPath(JTree tree, TreePath path)
          选择路径中的最后一个项并尝试对其进行编辑。
 booleanstopEditing(JTree tree)
          停止当前编辑会话。
protected  voidtoggleExpandState(TreePath path)
          如果路径不是展开的,则展开它;如果它是展开的,则折叠它。
protected  voiduninstallComponents()
          卸载渲染器窗格。
protected  voiduninstallDefaults()
           
protected  voiduninstallKeyboardActions()
           
protected  voiduninstallListeners()
           
 voiduninstallUI(JComponent c)
          在 installUI 期间,在指定组件上反向执行的配置操作。
protected  voidupdateCachedPreferredSize()
          更新 preferredSize 实例变量,该变量从 getPreferredSize() 返回。
protected  voidupdateCellEditor()
          基于包含我们的 JTree 的可编辑性更新 cellEditor。
protected  voidupdateDepthOffset()
          更新每次应该偏移的深度量。
protected  voidupdateExpandedDescendants(TreePath path)
          通过从树获取展开的子代并将其转发到树状态来更新 path 的所有子代的展开状态。
protected  voidupdateLayoutCacheExpandedNodes()
          让在 JTree 中展开的所有节点在 LayoutCache 中展开。
protected  voidupdateRenderer()
          当渲染器更改时从所处的树中传递消息。
protected  voidupdateSize()
          将缓存大小标记为无效并使用 treeDidChange 传递树的信息。
 
从类 javax.swing.plaf.ComponentUI 继承的方法
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

collapsedIcon

protected transient Icon collapsedIcon

expandedIcon

protected transient Icon expandedIcon

leftChildIndent

protected int leftChildIndent
从左页边空白到将绘制垂直虚线的位置之间的距离。


rightChildIndent

protected int rightChildIndent
添加到 leftChildIndent 以确定将绘制单元格内容的位置的距离。


totalChildIndent

protected int totalChildIndent
将缩进的总距离。leftChildIndent 和 rightChildIndent 的和。


preferredMinSize

protected Dimension preferredMinSize
最大首选大小。


lastSelectedRow

protected int lastSelectedRow
上一次选中行的索引。