Nó de JTree com negrito

Olá pessoal…

Tenho uma JTree que eu implementei a interface TreeCellRenderer, a classe tá funcionando tudo certo quanto aos ícones setados, cores, coisa e tal.

Mas quando o eu seto fonte negrito em um nó ele fica a String fica pela metade com três pontinhos, indicando que tem mais texto.

Ex:
Sem negrito = INFORMÁTICA
Com negrito = INFORMÁ…

Eu seto a fonte antes de montar a label… Segue trecho do código:

    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus){

        //Seta a fonte em negrito ou não dependendo se o nodo se encontra em uso. Apenas um nó da JTree fica em uso.
        this.setFont(new java.awt.Font("Tahoma", ((Node) value).isInUse() ? 1 : 0, 11));
        String stringValue = tree.convertValueToText(value, sel, expanded, leaf, row, hasFocus);

        this.setIcon(this.getIcone("blue"));

        setText(stringValue);
        this.tree = tree;
        this.hasFocus = hasFocus;

        Color fg = null;
        isDropCell = false;

        JTree.DropLocation dropLocation = tree.getDropLocation();
        if(dropLocation != null && dropLocation.getChildIndex() == -1 && tree.getRowForPath(dropLocation.getPath()) == row){
            Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
            fg = (col != null) ? col: getTextSelectionColor();
            isDropCell = true;
        }else
            fg = (sel) ? getTextSelectionColor() : getTextNonSelectionColor();

        setForeground(fg);

        selected = sel;

        return this;
    }

Será que alguém pode me ajudar?

[quote=brunooflores]Olá pessoal…

Tenho uma JTree que eu implementei a interface TreeCellRenderer, a classe tá funcionando tudo certo quanto aos ícones setados, cores, coisa e tal.

Mas quando o eu seto fonte negrito em um nó ele fica a String fica pela metade com três pontinhos, indicando que tem mais texto.

Ex:
Sem negrito = INFORMÁTICA
Com negrito = INFORMÁ…

Eu seto a fonte antes de montar a label… Segue trecho do código:

    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus){

        //Seta a fonte em negrito ou não dependendo se o nodo se encontra em uso. Apenas um nó da JTree fica em uso.
        this.setFont(new java.awt.Font("Tahoma", ((Node) value).isInUse() ? 1 : 0, 11));
        String stringValue = tree.convertValueToText(value, sel, expanded, leaf, row, hasFocus);

        this.setIcon(this.getIcone("blue"));

        setText(stringValue);
        this.tree = tree;
        this.hasFocus = hasFocus;

        Color fg = null;
        isDropCell = false;

        JTree.DropLocation dropLocation = tree.getDropLocation();
        if(dropLocation != null && dropLocation.getChildIndex() == -1 && tree.getRowForPath(dropLocation.getPath()) == row){
            Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
            fg = (col != null) ? col: getTextSelectionColor();
            isDropCell = true;
        }else
            fg = (sel) ? getTextSelectionColor() : getTextNonSelectionColor();

        setForeground(fg);

        selected = sel;

        return this;
    }

Será que alguém pode me ajudar?
[/quote]

isso ai é pq a width do seu jtree (onde aparece os textos) fica pequena. tenta aumentar um pouco mais. Quando vc coloca em negrito, o comprimento as vezes dependendo da fonte fica maior e pode não caber na tela. Esse recurso dos 3 pontos é justamente pra indciar que existe mais texto.