Index: openide/src/org/openide/explorer/view/TreeTable.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/view/TreeTable.java,v retrieving revision 1.25 diff -u -r1.25 TreeTable.java --- openide/src/org/openide/explorer/view/TreeTable.java 15 Apr 2003 14:03:51 -0000 1.25 +++ openide/src/org/openide/explorer/view/TreeTable.java 25 Apr 2003 12:48:03 -0000 @@ -129,6 +129,7 @@ UIManager.put ("Table.gridColor", new JTable ().getGridColor ()); // NOI18N } setUI(new TreeTableUI()); + needCalcRowHeight = true; } /* Workaround for BasicTableUI anomaly. Make sure the UI never tries to @@ -141,6 +142,26 @@ return (getColumnClass(editingColumn) == TreeTableModelAdapter.class) ? -1 : editingRow; } + + boolean needCalcRowHeight = true; + public void paint (Graphics g) { + if (needCalcRowHeight) { + calcRowHeight(g); + } + super.paint(g); + } + + /** Calculate the height of rows based on the current font. This is + * done when the first paint occurs, to ensure that a valid Graphics + * object is available. + * @since 1.25 */ + private void calcRowHeight(Graphics g) { + Font f = getFont(); + FontMetrics fm = g.getFontMetrics(f); + int rowHeight = fm.getHeight(); + needCalcRowHeight = false; + setRowHeight (rowHeight); + } /* * Overridden to pass the new rowHeight to the tree.