[JGraph] Comment changer le texte affiché dans une cellule
Bonjour, j'essaie depuis qq temps avec JGraph d'ajouter du texte dans une cellule apres sa création. Etant donné la classe VertexRenderer hérite de JLabel, j'ai voulu changer son text en faisant setText mais ce petit bout de code que j'ai écrit ne marche pas :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
protected void showProperty(JGraph graph, String property, boolean isSelected) {
CellView[] cells = graph.getGraphLayoutCache().getAllViews();
StringBuffer res = new StringBuffer();
for( int i = 0 ; i < cells.length ; i++){
Component c = cells[i].getRendererComponent(graph, false, false, false);
JLabel label = (JLabel) c;
String text = label.getText();
text += property;
label.setText(text);
cells[i].update(graph.getGraphLayoutCache());
}
} |
Je suis ouvert à toutes les suggestions !!