APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.jvm.hotspot.ui.treetable

public Class JTreeTable

extends JTable
Class Inheritance
Imports
java.awt.*, javax.swing.*, javax.swing.border.*, javax.swing.event.*, javax.swing.tree.*, javax.swing.table.*, java.awt.event.*, java.util.EventObject

This example shows how to create a simple JTreeTable component, by using a JTree as a renderer (and editor) for the cells in a particular column in the JTable.
Authors
Philip Milne, Scott Violet

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
JTreeTable.JTreeTableCellRenderer

A DefaultTreeCellRenderer which can optionally skip drawing all icons.

pack-priv class
JTreeTable.ListToTreeSelectionModelWrapper

ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel to listen for changes in the ListSelectionModel it maintains.

public class
JTreeTable.TreeTableCellEditor

An editor that can be used to edit the tree column.

public class
JTreeTable.TreeTableCellRenderer

A TreeCellRenderer that displays a JTree.

pack-priv static class
JTreeTable.TreeTableTextField

Component used by TreeTableCellEditor.

Field Summary

Modifier and TypeField and Description
private boolean
protected JTreeTable.TreeTableCellRenderer
tree

A subclass of JTree.

private boolean
Inherited from javax.swing.JTable:
AUTO_RESIZE_ALL_COLUMNSAUTO_RESIZE_LAST_COLUMNAUTO_RESIZE_NEXT_COLUMNAUTO_RESIZE_OFFAUTO_RESIZE_SUBSEQUENT_COLUMNSautoCreateColumnsFromModelautoResizeModecellEditorcellSelectionEnabledcolumnModeldataModeldefaultEditorsByColumnClassdefaultRenderersByColumnClasseditingColumneditingRoweditorCompgridColorpreferredViewportSizerowHeightrowMarginrowSelectionAllowedselectionBackgroundselectionForegroundselectionModelshowHorizontalLinesshowVerticalLinestableHeader

Constructor Summary

AccessConstructor and Description
public
JTreeTable(TreeTableModel treeTableModel)

Method Summary

Modifier and TypeMethod and Description
public boolean
editCellAt(int row, int column, EventObject e)

Overrides javax.swing.JTable.editCellAt.

Overridden to invoke repaint for the particular location if the column contains the tree.

public int
getEditingRow()

Overrides javax.swing.JTable.getEditingRow.

Workaround for BasicTableUI anomaly.

public boolean
public boolean
public JTree
getTree()

Returns the tree that is being shared between the model.

public boolean
private int
realEditingRow()

Returns the actual row that is editing as getEditingRow will always return -1.

public void
setRootVisible(boolean visible)

public void
setRowHeight(int rowHeight)

Overrides javax.swing.JTable.setRowHeight.

Overridden to pass the new rowHeight to the tree.

public void
setShowsIcons(boolean show)

public void
setShowsRootHandles(boolean newValue)

public void
setTreeEditable(boolean editable)

public void
sizeColumnsToFit(int resizingColumn)

Overrides javax.swing.JTable.sizeColumnsToFit.

This is overridden to invoke supers implementation, and then, if the receiver is editing a Tree column, the editors bounds is reset.

public void
updateUI()

Overrides javax.swing.JTable.updateUI.

Overridden to message super and forward the method to the tree.

Inherited from javax.swing.JTable:
addColumnaddColumnSelectionIntervaladdNotifyaddRowSelectionIntervalchangeSelectionclearSelectioncolumnAddedcolumnAtPointcolumnMarginChangedcolumnMovedcolumnRemovedcolumnSelectionChangedconfigureEnclosingScrollPaneconvertColumnIndexToModelconvertColumnIndexToViewconvertRowIndexToModelconvertRowIndexToViewcreateDefaultColumnModelcreateDefaultColumnsFromModelcreateDefaultDataModelcreateDefaultEditorscreateDefaultRendererscreateDefaultSelectionModelcreateDefaultTableHeadercreateScrollPaneForTabledoLayouteditCellAteditingCancelededitingStoppedgetAccessibleContextgetAutoCreateColumnsFromModelgetAutoCreateRowSortergetAutoResizeModegetCellEditorgetCellEditorgetCellRectgetCellRenderergetCellSelectionEnabledgetColumngetColumnClassgetColumnCountgetColumnModelgetColumnNamegetColumnSelectionAllowedgetDefaultEditorgetDefaultRenderergetDragEnabledgetDropLocationgetDropModegetEditingColumngetEditorComponentgetFillsViewportHeightgetGridColorgetIntercellSpacinggetModelgetPreferredScrollableViewportSizegetPrintablegetRowCountgetRowHeightgetRowHeightgetRowMargingetRowSelectionAllowedgetRowSortergetScrollableBlockIncrementgetScrollableTracksViewportHeightgetScrollableTracksViewportWidthgetScrollableUnitIncrementgetSelectedColumngetSelectedColumnCountgetSelectedColumnsgetSelectedRowgetSelectedRowCountgetSelectedRowsgetSelectionBackgroundgetSelectionForegroundgetSelectionModelgetShowHorizontalLinesgetShowVerticalLinesgetSurrendersFocusOnKeystrokegetTableHeadergetToolTipTextgetUIgetUIClassIDgetUpdateSelectionOnSortgetValueAtinitializeLocalVarsisCellEditableisCellSelectedisColumnSelectedisEditingisRowSelectedmoveColumnparamStringprepareEditorprepareRendererprintprintprintprintprintprocessKeyBindingremoveColumnremoveColumnSelectionIntervalremoveEditorremoveNotifyremoveRowSelectionIntervalresizeAndRepaintrowAtPointselectAllsetAutoCreateColumnsFromModelsetAutoCreateRowSortersetAutoResizeModesetCellEditorsetCellSelectionEnabledsetColumnModelsetColumnSelectionAllowedsetColumnSelectionIntervalsetDefaultEditorsetDefaultRenderersetDragEnabledsetDropModesetEditingColumnsetEditingRowsetFillsViewportHeightsetGridColorsetIntercellSpacingsetModelsetPreferredScrollableViewportSizesetRowHeightsetRowMarginsetRowSelectionAllowedsetRowSelectionIntervalsetRowSortersetSelectionBackgroundsetSelectionForegroundsetSelectionModesetSelectionModelsetShowGridsetShowHorizontalLinessetShowVerticalLinessetSurrendersFocusOnKeystrokesetTableHeadersetUIsetUpdateSelectionOnSortsetValueAtsizeColumnsToFitsorterChangedtableChangedunconfigureEnclosingScrollPanevalueChanged

Field Detail

showsIconsback to summary
private boolean showsIcons
treeback to summary
protected JTreeTable.TreeTableCellRenderer tree

A subclass of JTree.

treeEditableback to summary
private boolean treeEditable

Constructor Detail

JTreeTableback to summary
public JTreeTable(TreeTableModel treeTableModel)

Method Detail

editCellAtback to summary
public boolean editCellAt(int row, int column, EventObject e)

Overrides javax.swing.JTable.editCellAt.

Overridden to invoke repaint for the particular location if the column contains the tree. This is done as the tree editor does not fill the bounds of the cell, we need the renderer to paint the tree in the background, and then draw the editor over it.

getEditingRowback to summary
public int getEditingRow()

Overrides javax.swing.JTable.getEditingRow.

Workaround for BasicTableUI anomaly. Make sure the UI never tries to resize the editor. The UI currently uses different techniques to paint the renderers and editors and overriding setBounds() below is not the right thing to do for an editor. Returning -1 for the editing row in this case, ensures the editor is never painted.

getShowsIconsback to summary
public boolean getShowsIcons()
getShowsRootHandlesback to summary
public boolean getShowsRootHandles()
getTreeback to summary
public JTree getTree()

Returns the tree that is being shared between the model.

getTreeEditableback to summary
public boolean getTreeEditable()
realEditingRowback to summary
private int realEditingRow()

Returns the actual row that is editing as getEditingRow will always return -1.

setRootVisibleback to summary
public void setRootVisible(boolean visible)
setRowHeightback to summary
public void setRowHeight(int rowHeight)

Overrides javax.swing.JTable.setRowHeight.

Overridden to pass the new rowHeight to the tree.

setShowsIconsback to summary
public void setShowsIcons(boolean show)
setShowsRootHandlesback to summary
public void setShowsRootHandles(boolean newValue)
setTreeEditableback to summary
public void setTreeEditable(boolean editable)
sizeColumnsToFitback to summary
public void sizeColumnsToFit(int resizingColumn)

Overrides javax.swing.JTable.sizeColumnsToFit.

This is overridden to invoke supers implementation, and then, if the receiver is editing a Tree column, the editors bounds is reset. The reason we have to do this is because JTable doesn't think the table is being edited, as getEditingRow returns -1, and therefore doesn't automatically resize the editor for us.

updateUIback to summary
public void updateUI()

Overrides javax.swing.JTable.updateUI.

Overridden to message super and forward the method to the tree. Since the tree is not actually in the component hieachy it will never receive this unless we forward it in this manner.

sun.jvm.hotspot.ui.treetable back to summary

pack-priv Class JTreeTable.JTreeTableCellRenderer

extends DefaultTreeCellRenderer
Class Inheritance

A DefaultTreeCellRenderer which can optionally skip drawing all icons.

Field Summary

Inherited from javax.swing.tree.DefaultTreeCellRenderer:
backgroundNonSelectionColorbackgroundSelectionColorborderSelectionColorclosedIconhasFocusleafIconopenIconselectedtextNonSelectionColortextSelectionColor

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Icon
getClosedIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getClosedIcon.

Returns the icon used to represent non-leaf nodes that are not expanded.

public Icon
getDefaultClosedIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getDefaultClosedIcon.

Returns the default icon, for the current laf, that is used to represent non-leaf nodes that are not expanded.

public Icon
getDefaultLeafIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getDefaultLeafIcon.

Returns the default icon, for the current laf, that is used to represent leaf nodes.

public Icon
getDefaultOpenIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getDefaultOpenIcon.

Returns the default icon, for the current laf, that is used to represent non-leaf nodes that are expanded.

public Icon
getLeafIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getLeafIcon.

Returns the icon used to represent leaf nodes.

public Icon
getOpenIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getOpenIcon.

Returns the icon used to represent non-leaf nodes that are expanded.

Inherited from javax.swing.tree.DefaultTreeCellRenderer:
firePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangegetBackgroundNonSelectionColorgetBackgroundSelectionColorgetBorderSelectionColorgetFontgetPreferredSizegetTextNonSelectionColorgetTextSelectionColorgetTreeCellRendererComponentinvalidatepaintrepaintrepaintrepaintrevalidatesetBackgroundsetBackgroundNonSelectionColorsetBackgroundSelectionColorsetBorderSelectionColorsetClosedIconsetFontsetLeafIconsetOpenIconsetTextNonSelectionColorsetTextSelectionColorupdateUIvalidate

Constructor Detail

JTreeTableCellRendererback to summary
pack-priv JTreeTableCellRenderer()

Method Detail

getClosedIconback to summary
public Icon getClosedIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getClosedIcon.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getClosedIcon.

Returns the icon used to represent non-leaf nodes that are not expanded.

getDefaultClosedIconback to summary
public Icon getDefaultClosedIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getDefaultClosedIcon.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getDefaultClosedIcon.

Returns the default icon, for the current laf, that is used to represent non-leaf nodes that are not expanded.

getDefaultLeafIconback to summary
public Icon getDefaultLeafIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getDefaultLeafIcon.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getDefaultLeafIcon.

Returns the default icon, for the current laf, that is used to represent leaf nodes.

getDefaultOpenIconback to summary
public Icon getDefaultOpenIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getDefaultOpenIcon.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getDefaultOpenIcon.

Returns the default icon, for the current laf, that is used to represent non-leaf nodes that are expanded.

getLeafIconback to summary
public Icon getLeafIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getLeafIcon.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getLeafIcon.

Returns the icon used to represent leaf nodes.

getOpenIconback to summary
public Icon getOpenIcon()

Overrides javax.swing.tree.DefaultTreeCellRenderer.getOpenIcon.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getOpenIcon.

Returns the icon used to represent non-leaf nodes that are expanded.

sun.jvm.hotspot.ui.treetable back to summary

pack-priv Class JTreeTable.ListToTreeSelectionModelWrapper

extends DefaultTreeSelectionModel
Class Inheritance

ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel to listen for changes in the ListSelectionModel it maintains. Once a change in the ListSelectionModel happens, the paths are updated in the DefaultTreeSelectionModel.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
JTreeTable.ListToTreeSelectionModelWrapper.ListSelectionHandler

Class responsible for calling updateSelectedPathsFromSelectedRows when the selection of the list changse.

Field Summary

Modifier and TypeField and Description
protected boolean
updatingListSelectionModel

Set to true when we are updating the ListSelectionModel.

Inherited from javax.swing.tree.DefaultTreeSelectionModel:
changeSupportleadIndexleadPathleadRowlistenerListlistSelectionModelrowMapperselectionSELECTION_MODE_PROPERTYselectionMode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ListSelectionListener
createListSelectionListener()

Creates and returns an instance of ListSelectionHandler.

pack-priv ListSelectionModel
getListSelectionModel()

Returns the list selection model.

public void
resetRowSelection()

Overrides javax.swing.tree.DefaultTreeSelectionModel.resetRowSelection.

Implements javax.swing.tree.TreeSelectionModel.resetRowSelection.

This is overridden to set updatingListSelectionModel and message super.

protected void
updateSelectedPathsFromSelectedRows()

If updatingListSelectionModel is false, this will reset the selected paths from the selected rows in the list selection model.

Inherited from javax.swing.tree.DefaultTreeSelectionModel:
addPropertyChangeListeneraddSelectionPathaddSelectionPathsaddTreeSelectionListenerarePathsContiguouscanPathsBeAddedcanPathsBeRemovedclearSelectionclonefireValueChangedgetLeadSelectionPathgetLeadSelectionRowgetListenersgetMaxSelectionRowgetMinSelectionRowgetPropertyChangeListenersgetRowMappergetSelectionCountgetSelectionModegetSelectionPathgetSelectionPathsgetSelectionRowsgetTreeSelectionListenersinsureRowContinuityinsureUniquenessisPathSelectedisRowSelectedisSelectionEmptynotifyPathChangeremovePropertyChangeListenerremoveSelectionPathremoveSelectionPathsremoveTreeSelectionListenersetRowMappersetSelectionModesetSelectionPathsetSelectionPathstoStringupdateLeadIndex

Field Detail

updatingListSelectionModelback to summary
protected boolean updatingListSelectionModel

Set to true when we are updating the ListSelectionModel.

Constructor Detail

ListToTreeSelectionModelWrapperback to summary
public ListToTreeSelectionModelWrapper()

Method Detail

createListSelectionListenerback to summary
protected ListSelectionListener createListSelectionListener()

Creates and returns an instance of ListSelectionHandler.

getListSelectionModelback to summary
pack-priv ListSelectionModel getListSelectionModel()

Returns the list selection model. ListToTreeSelectionModelWrapper listens for changes to this model and updates the selected paths accordingly.

resetRowSelectionback to summary
public void resetRowSelection()

Overrides javax.swing.tree.DefaultTreeSelectionModel.resetRowSelection.

Implements javax.swing.tree.TreeSelectionModel.resetRowSelection.

This is overridden to set updatingListSelectionModel and message super. This is the only place DefaultTreeSelectionModel alters the ListSelectionModel.

updateSelectedPathsFromSelectedRowsback to summary
protected void updateSelectedPathsFromSelectedRows()

If updatingListSelectionModel is false, this will reset the selected paths from the selected rows in the list selection model.

sun.jvm.hotspot.ui.treetable back to summary

pack-priv Class JTreeTable.ListToTreeSelectionModelWrapper.ListSelectionHandler

extends Object
implements ListSelectionListener
Class Inheritance
  • java.lang.Object
  • sun.jvm.hotspot.ui.treetable.JTreeTable.ListToTreeSelectionModelWrapper.ListSelectionHandler
All Implemented Interfaces
javax.swing.event.ListSelectionListener, java.util.EventListener

Class responsible for calling updateSelectedPathsFromSelectedRows when the selection of the list changse.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
valueChanged(ListSelectionEvent e)

Implements javax.swing.event.ListSelectionListener.valueChanged.

Called whenever the value of the selection changes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ListSelectionHandlerback to summary
pack-priv ListSelectionHandler()

Method Detail

valueChangedback to summary
public void valueChanged(ListSelectionEvent e)

Implements javax.swing.event.ListSelectionListener.valueChanged.

Doc from javax.swing.event.ListSelectionListener.valueChanged.

Called whenever the value of the selection changes.

sun.jvm.hotspot.ui.treetable back to summary

public Class JTreeTable.TreeTableCellEditor

extends DefaultCellEditor
Class Inheritance

An editor that can be used to edit the tree column. This extends DefaultCellEditor and uses a JTextField (actually, TreeTableTextField) to perform the actual editing.

To support editing of the tree column we can not make the tree editable. The reason this doesn't work is that you can not use the same component for editing and rendering. The table may have the need to paint cells, while a cell is being edited. If the same component were used for the rendering and editing the component would be moved around, and the contents would change. When editing, this is undesirable, the contents of the text field must stay the same, including the caret blinking, and selections persisting. For this reason the editing is done via a TableCellEditor.

Another interesting thing to be aware of is how tree positions its render and editor. The render/editor is responsible for drawing the icon indicating the type of node (leaf, branch...). The tree is responsible for drawing any other indicators, perhaps an additional +/- sign, or lines connecting the various nodes. So, the renderer is positioned based on depth. On the other hand, table always makes its editor fill the contents of the cell. To get the allusion that the table cell editor is part of the tree, we don't want the table cell editor to fill the cell bounds. We want it to be placed in the same manner as tree places it editor, and have table message the tree to paint any decorations the tree wants. Then, we would only have to worry about the editing part. The approach taken here is to determine where tree would place the editor, and to override the reshape method in the JTextField component to nudge the textfield to the location tree would place it. Since JTreeTable will paint the tree behind the editor everything should just work. So, that is what we are doing here. Determining of the icon position will only work if the TreeCellRenderer is an instance of DefaultTreeCellRenderer. If you need custom TreeCellRenderers, that don't descend from DefaultTreeCellRenderer, and you want to support editing in JTreeTable, you will have to do something similar.

Field Summary

Inherited from javax.swing.DefaultCellEditor:
clickCountToStartdelegateeditorComponent

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Component
getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int r, int c)

Overrides javax.swing.DefaultCellEditor.getTableCellEditorComponent.

Implements javax.swing.table.TableCellEditor.getTableCellEditorComponent.

Overridden to determine an offset that tree would place the editor at.

public boolean
isCellEditable(EventObject e)

Overrides javax.swing.DefaultCellEditor.isCellEditable.

Implements javax.swing.CellEditor.isCellEditable.

This is overridden to forward the event to the tree.

Inherited from javax.swing.DefaultCellEditor:
cancelCellEditinggetCellEditorValuegetClickCountToStartgetComponentgetTreeCellEditorComponentsetClickCountToStartshouldSelectCellstopCellEditing

Constructor Detail

TreeTableCellEditorback to summary
public TreeTableCellEditor()

Method Detail

getTableCellEditorComponentback to summary
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int r, int c)

Overrides javax.swing.DefaultCellEditor.getTableCellEditorComponent.

Implements javax.swing.table.TableCellEditor.getTableCellEditorComponent.

Overridden to determine an offset that tree would place the editor at. The offset is determined from the getRowBounds JTree method, and additionally from the icon DefaultTreeCellRenderer will use.

The offset is then set on the TreeTableTextField component created in the constructor, and returned.

isCellEditableback to summary
public boolean isCellEditable(EventObject e)

Overrides javax.swing.DefaultCellEditor.isCellEditable.

Implements javax.swing.CellEditor.isCellEditable.

This is overridden to forward the event to the tree. This will return true if the click count >= 3, or the event is null.

sun.jvm.hotspot.ui.treetable back to summary

public Class JTreeTable.TreeTableCellRenderer

extends JTree
implements TableCellRenderer
Class Inheritance
All Implemented Interfaces
javax.swing.table.TableCellRenderer

A TreeCellRenderer that displays a JTree.

Field Summary

Modifier and TypeField and Description
protected Border
highlightBorder

Border to draw around the tree, if this is non-null, it will be painted.

protected int
visibleRow

Last table/tree row asked to renderer.

Inherited from javax.swing.JTree:
ANCHOR_SELECTION_PATH_PROPERTYCELL_EDITOR_PROPERTYCELL_RENDERER_PROPERTYcellEditorcellRenderereditableEDITABLE_PROPERTYEXPANDS_SELECTED_PATHS_PROPERTYINVOKES_STOP_CELL_EDITING_PROPERTYinvokesStopCellEditingLARGE_MODEL_PROPERTYlargeModelLEAD_SELECTION_PATH_PROPERTYROOT_VISIBLE_PROPERTYrootVisibleROW_HEIGHT_PROPERTYrowHeightSCROLLS_ON_EXPAND_PROPERTYscrollsOnExpandSELECTION_MODEL_PROPERTYselectionModelselectionRedirectorSHOWS_ROOT_HANDLES_PROPERTYshowsRootHandlesTOGGLE_CLICK_COUNT_PROPERTYtoggleClickCountTREE_MODEL_PROPERTYtreeModeltreeModelListenerVISIBLE_ROW_COUNT_PROPERTYvisibleRowCount

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Component
getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)

Implements javax.swing.table.TableCellRenderer.getTableCellRendererComponent.

TreeCellRenderer method.

public void
paint(Graphics g)

Overrides javax.swing.JComponent.paint.

Sublcassed to translate the graphics such that the last visible row will be drawn at 0,0.

public void
setBounds(int x, int y, int w, int h)

Overrides java.awt.Component.setBounds.

This is overridden to set the height to match that of the JTable.

public void
setRowHeight(int rowHeight)

Overrides javax.swing.JTree.setRowHeight.

Sets the row height of the tree, and forwards the row height to the table.

public void
updateUI()

Overrides javax.swing.JTree.updateUI.

updateUI is overridden to set the colors of the Tree's renderer to match that of the table.

Inherited from javax.swing.JTree:
addSelectionIntervaladdSelectionPathaddSelectionPathsaddSelectionRowaddSelectionRowsaddTreeExpansionListeneraddTreeSelectionListeneraddTreeWillExpandListenercancelEditingclearSelectionclearToggledPathscollapsePathcollapseRowconvertValueToTextcreateTreeModelcreateTreeModelListenerexpandPathexpandRowfireTreeCollapsedfireTreeExpandedfireTreeWillCollapsefireTreeWillExpandfireValueChangedgetAccessibleContextgetAnchorSelectionPathgetCellEditorgetCellRenderergetClosestPathForLocationgetClosestRowForLocationgetDefaultTreeModelgetDescendantToggledPathsgetDragEnabledgetDropLocationgetDropModegetEditingPathgetExpandedDescendantsgetExpandsSelectedPathsgetInvokesStopCellEditinggetLastSelectedPathComponentgetLeadSelectionPathgetLeadSelectionRowgetMaxSelectionRowgetMinSelectionRowgetModelgetNextMatchgetPathBetweenRowsgetPathBoundsgetPathForLocationgetPathForRowgetPreferredScrollableViewportSizegetRowBoundsgetRowCountgetRowForLocationgetRowForPathgetRowHeightgetScrollableBlockIncrementgetScrollableTracksViewportHeightgetScrollableTracksViewportWidthgetScrollableUnitIncrementgetScrollsOnExpandgetSelectionCountgetSelectionModelgetSelectionPathgetSelectionPathsgetSelectionRowsgetShowsRootHandlesgetToggleClickCountgetToolTipTextgetTreeExpansionListenersgetTreeSelectionListenersgetTreeWillExpandListenersgetUIgetUIClassIDgetVisibleRowCounthasBeenExpandedisCollapsedisCollapsedisEditableisEditingisExpandedisExpandedisFixedRowHeightisLargeModelisPathEditableisPathSelectedisRootVisibleisRowSelectedisSelectionEmptyisVisiblemakeVisibleparamStringremoveDescendantSelectedPathsremoveDescendantToggledPathsremoveSelectionIntervalremoveSelectionPathremoveSelectionPathsremoveSelectionRowremoveSelectionRowsremoveTreeExpansionListenerremoveTreeSelectionListenerremoveTreeWillExpandListenerscrollPathToVisiblescrollRowToVisiblesetAnchorSelectionPathsetCellEditorsetCellRenderersetDragEnabledsetDropModesetEditablesetExpandedStatesetExpandsSelectedPathssetInvokesStopCellEditingsetLargeModelsetLeadSelectionPathsetModelsetRootVisiblesetScrollsOnExpandsetSelectionIntervalsetSelectionModelsetSelectionPathsetSelectionPathssetSelectionRowsetSelectionRowssetShowsRootHandlessetToggleClickCountsetUIsetVisibleRowCountstartEditingAtPathstopEditingtreeDidChange

Field Detail

highlightBorderback to summary
protected Border highlightBorder

Border to draw around the tree, if this is non-null, it will be painted.

visibleRowback to summary
protected int visibleRow

Last table/tree row asked to renderer.

Constructor Detail

TreeTableCellRendererback to summary
public TreeTableCellRenderer(TreeModel model)

Method Detail

getTableCellRendererComponentback to summary
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)

Implements javax.swing.table.TableCellRenderer.getTableCellRendererComponent.

TreeCellRenderer method. Overridden to update the visible row.

paintback to summary
public void paint(Graphics g)

Overrides javax.swing.JComponent.paint.

Sublcassed to translate the graphics such that the last visible row will be drawn at 0,0.

setBoundsback to summary
public void setBounds(int x, int y, int w, int h)

Overrides java.awt.Component.setBounds.

This is overridden to set the height to match that of the JTable.

setRowHeightback to summary
public void setRowHeight(int rowHeight)

Overrides javax.swing.JTree.setRowHeight.

Sets the row height of the tree, and forwards the row height to the table.

updateUIback to summary
public void updateUI()

Overrides javax.swing.JTree.updateUI.

updateUI is overridden to set the colors of the Tree's renderer to match that of the table.

sun.jvm.hotspot.ui.treetable back to summary

pack-priv Class JTreeTable.TreeTableTextField

extends JTextField
Class Inheritance

Component used by TreeTableCellEditor. The only thing this does is to override the reshape method, and to ALWAYS make the x location be offset.

Field Summary

Modifier and TypeField and Description
public int
Inherited from javax.swing.JTextField:
notifyAction

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
setBounds(int x, int y, int w, int h)

Overrides java.awt.Component.setBounds.

Moves and resizes this component.

Inherited from javax.swing.JTextField:
actionPropertyChangedaddActionListenerconfigurePropertiesFromActioncreateActionPropertyChangeListenercreateDefaultModelfireActionPerformedgetAccessibleContextgetActiongetActionListenersgetActionsgetColumnsgetColumnWidthgetHorizontalAlignmentgetHorizontalVisibilitygetPreferredSizegetScrollOffsetgetUIClassIDisValidateRootparamStringpostActionEventremoveActionListenerscrollRectToVisiblesetActionsetActionCommandsetColumnssetDocumentsetFontsetHorizontalAlignmentsetScrollOffset

Field Detail

offsetback to summary
public int offset

Constructor Detail

TreeTableTextFieldback to summary
pack-priv TreeTableTextField()

Method Detail

setBoundsback to summary
public void setBounds(int x, int y, int w, int h)

Overrides java.awt.Component.setBounds.

Doc from java.awt.Component.setBounds.

Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.

This method changes layout-related information, and therefore, invalidates the component hierarchy.