Changeset 6249
- Timestamp:
- 2003-12-12T17:49:32+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r6157 r6249 10 10 import javax.swing.*; 11 11 import javax.swing.event.*; 12 import javax.swing.plaf.basic.BasicTreeUI; 12 13 import javax.swing.tree.*; 13 14 import org.greenstone.gatherer.Dictionary; … … 97 98 this.setOpaque(true); 98 99 this.setSelectionModel(new DragTreeSelectionModel(this, mixed_selection)); 100 this.setShowsRootHandles(true); 101 this.setUI(new BasicTreeUI()); 99 102 // Connection 100 103 addTreeSelectionListener(this); … … 104 107 //renderer.setBackgroundNonSelectionColor(new Color(0,0,0,0)); 105 108 setCellRenderer(renderer); 106 107 // Drag'n'drop Setup 108 // Drag source setup. 109 // It turns out VariableHeightLayoutCache is buggy under MacOS, so I'll force it to use FixedHeightLayoutCache. To do that I have to set a cell height, ala below, and set the large model property to true, ala above. And buggy VariableHeightLayoutCache goes away. Plus this actually provides a minor performance boost as the layout manager doesn't have to calculate new bounds each time (well... I suppose any gain is actually pretty much eclipsed by the time taken for file access while we determine what a certain nodes children are). 110 // And once we have the cell renderer, use it to determine a fixed height for the rows 111 Component prototype_row = renderer.getTreeCellRendererComponent(this, "Prototype", true, true, false, 0, true); 112 this.setRowHeight(prototype_row.getSize().height); 113 prototype_row = null; 114 115 116 // Drag'n'drop Setup 117 // Drag source setup. 109 118 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(this, drag_action, this); 110 119 // Drop destination setup.
Note:
See TracChangeset
for help on using the changeset viewer.