private static class MyJTree extends JTree { ... public void invalidateNodeBoundsViaSideEffect() { if (ui instanceof BasicTreeUI) { BasicTreeUI basicTreeUI = (BasicTreeUI) ui; basicTreeUI.setLeftChildIndent(basicTreeUI.getLeftChildIndent()); }} public void invalidateNodeBoundsViaRefection() { if (ui instanceof BasicTreeUI) { try { Field field = BasicTreeUI.class.getDeclaredField("treeState"); field.setAccessible(true); AbstractLayoutCache treeState = (AbstractLayoutCache) field.get(ui); if (treeState != null) { treeState.invalidateSizes(); } } catch (Exception e) { } }}}
/** * Invalidates cell size caching in the ui delegate. May do nothing if there's no * safe (i.e. without reflection) way to message the delegate. <p> * * This implementation calls BasicTreeUI setLeftChildIndent with the old indent if available. * Beware: clearing the cache is an undocumented implementation side-effect of the * method. Revisit if we ever should have a custom ui delegate. * * */ public void invalidateCellSizeCache() { if (getUI() instanceof BasicTreeUI) { BasicTreeUI ui = (BasicTreeUI) getUI(); ui.setLeftChildIndent(ui.getLeftChildIndent()); } }
/** * Invalidates cell size caching in the ui delegate. May do nothing if there's no * safe (i.e. without reflection) way to message the delegate. <p> * * This implementation calls BasicTreeUI setLeftChildIndent with the old indent if available. * Beware: clearing the cache is an undocumented implementation side-effect of the * method. Revisit if we ever should have a custom ui delegate. * * */ public void invalidateCellSizeCache() { if (getUI() instanceof BasicTreeUI) { BasicTreeUI ui = (BasicTreeUI) getUI(); ui.setLeftChildIndent(ui.getLeftChildIndent()); } }
/** * Invalidates cell size caching in the ui delegate. May do nothing if there's no * safe (i.e. without reflection) way to message the delegate. <p> * * This implementation calls BasicTreeUI setLeftChildIndent with the old indent if available. * Beware: clearing the cache is an undocumented implementation side-effect of the * method. Revisit if we ever should have a custom ui delegate. * * */ public void invalidateCellSizeCache() { if (getUI() instanceof BasicTreeUI) { BasicTreeUI ui = (BasicTreeUI) getUI(); ui.setLeftChildIndent(ui.getLeftChildIndent()); } }
/** * Invalidates cell size caching in the ui delegate. May do nothing if there's no * safe (i.e. without reflection) way to message the delegate. <p> * * This implementation calls BasicTreeUI setLeftChildIndent with the old indent if available. * Beware: clearing the cache is an undocumented implementation side-effect of the * method. Revisit if we ever should have a custom ui delegate. * * */ public void invalidateCellSizeCache() { if (getUI() instanceof BasicTreeUI) { BasicTreeUI ui = (BasicTreeUI) getUI(); ui.setLeftChildIndent(ui.getLeftChildIndent()); } }
m_objTree = new JTree(m_objModelTree); m_objTree.setCellRenderer(new QCTreeCellRenderer()); ((BasicTreeUI)m_objTree.getUI()).setLeftChildIndent(20); m_objTree.setRowHeight(35);
if (ui instanceof BasicTreeUI) { BasicTreeUI basicTreeUI = (BasicTreeUI) ui; basicTreeUI.setLeftChildIndent(basicTreeUI.getLeftChildIndent());
if (ui instanceof BasicTreeUI) { BasicTreeUI basic = (BasicTreeUI) ui; basic.setLeftChildIndent(basic.getLeftChildIndent());