Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- if (value instanceof DefaultMutableTreeNode)
- {
- value = ((DefaultMutableTreeNode) value).getUserObject();
- }
- if (value instanceof DTOObjectwithAttributes)
- {
- DTOObjectwithAttributes obj = (DTOObjectwithAttributes) value;
- if (obj.isFolder){
- this.setIcon(new ImageIcon("/EqGenerator/image/folder16.png"));
- this.setText(obj.Attributs);
- }else if (obj.isXor){
- this.setIcon(new ImageIcon("/EqGenerator/image/xorGate16.png"));
- this.setText(obj.Attributs);
- }
- }
- return this;
- }
- public class DTOObjectwithAttributes
- {
- /**
- * Paramètres
- */
- boolean isFolder;
- boolean isXor;
- String Attributs;
- /**
- * Constructeurs
- * @param n2
- * @param attributs
- * @param isOrange
- */
- protected DTOObjectwithAttributes(boolean isFolder,boolean isXor, String attributs){
- super();
- this.Attributs = attributs;
- this.isFolder=isFolder;
- this.isXor=isXor;
- }
- public String toString() {
- return this.Attributs;
- }
- }
Add Comment
Please, Sign In to add comment