grazie ragazzi, ci siamo quasi alla soluzione
ho scritto questo codice ancora incompleto
Il codice dà errore perchè il metodo setFont non esiste di una variabile DefaultMutableTreeNode, come faccio a cambiare font di un nodo?codice:private class MyTreeCellRenderer extends DefaultTreeCellRenderer { public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus ) { super.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus); DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; boolean isRootNode = node.isRoot(); if(isRootNode) { node.setFont(new Font("Arial Unicode MS", Font.BOLD, 12)); } return this; } }

Rispondi quotando