[JGraph] Changer la position du texte dans une cellule
Bonjour,
J'ai un graph où toutes les cellules ont une icone et un texte en dessous de l'icone. J'aimerais changer la position du texte et le mettre à droite de l'icone. Voici, un exemple de code que j'ai écrit mais ca ne marche pas :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
protected void moveTextToRight(JGraph graph) {
CellView[] cells = graph.getGraphLayoutCache().getAllViews();
Map nested = new HashMap();
for ( CellView cv : cells){
DefaultGraphCell c = (DefaultGraphCell)cv.getCell();
Map attributes = new HashMap();
if(c instanceof DefaultGraphCell) {
GraphConstants.setHorizontalAlignment(attributes, SwingConstants.RIGHT);
GraphConstants.setAutoSize(attributes, true);
nested.put(c, attributes);
graph.getGraphLayoutCache().edit(nested);
}
}
graph.refresh();
} |
Quelqu'un peut-il m'aider s'il vous plait?