9d8e3d5fd7
Modification de la fenêtre propriété du fichier d'analyse.
66 lines
2.0 KiB
Java
66 lines
2.0 KiB
Java
package fenetres;
|
|
|
|
import java.awt.Color;
|
|
import java.awt.Component;
|
|
|
|
import javax.swing.ImageIcon;
|
|
import javax.swing.JComponent;
|
|
import javax.swing.JTree;
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
|
|
|
import cXML.node;
|
|
|
|
public class MyCellRenderer extends DefaultTreeCellRenderer{
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Override
|
|
public Component getTreeCellRendererComponent(JTree tree, Object value,
|
|
boolean isSelected, boolean expanded, boolean leaf, int row,
|
|
boolean hasFocus) {
|
|
|
|
JComponent c = (JComponent) super.getTreeCellRendererComponent(tree, value, isSelected, expanded, leaf, row, hasFocus);
|
|
|
|
|
|
DefaultTreeCellRenderer cellRenderer = (DefaultTreeCellRenderer) tree.getCellRenderer();
|
|
|
|
|
|
cellRenderer.setOpenIcon(new ImageIcon(create.class.getResource("/resources/treeOpen.png")));
|
|
cellRenderer.setClosedIcon(new ImageIcon(create.class.getResource("/resources/treeClose.png")));
|
|
cellRenderer.setLeafIcon(new ImageIcon(create.class.getResource("/resources/treeLeaf.png")));
|
|
|
|
cellRenderer.setBackgroundNonSelectionColor(new Color(255, 255, 221));
|
|
cellRenderer.setBackgroundSelectionColor(new Color(0, 0, 128));
|
|
cellRenderer.setBorderSelectionColor(Color.black);
|
|
cellRenderer.setTextSelectionColor(Color.white);
|
|
cellRenderer.setTextNonSelectionColor(Color.blue);
|
|
|
|
|
|
node data = null;
|
|
if (value instanceof DefaultMutableTreeNode) {
|
|
final DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) value;
|
|
final Object userObject = node1.getUserObject();
|
|
if (userObject instanceof node) {
|
|
data = (node) userObject;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(data!=null) if(data.isEvaluate()) {
|
|
c.setForeground(Color.blue);
|
|
c.setBackground(Color.green);
|
|
c.setOpaque(true);
|
|
}
|
|
|
|
|
|
|
|
|
|
return c;
|
|
}
|
|
}
|