Guest User

Untitled

a guest
Dec 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. public Component getTreeCellRendererComponent(JTree tree, Object value,
  2. boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
  3. {
  4. super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
  5.  
  6. if (value instanceof DefaultMutableTreeNode)
  7. {
  8. value = ((DefaultMutableTreeNode) value).getUserObject();
  9. }
  10.  
  11. if (value instanceof DTOObjectwithAttributes)
  12. {
  13. DTOObjectwithAttributes obj = (DTOObjectwithAttributes) value;
  14.  
  15. if (obj.isFolder){
  16. this.setIcon(new ImageIcon("/EqGenerator/image/folder16.png"));
  17. this.setText(obj.Attributs);
  18. }else if (obj.isXor){
  19. this.setIcon(new ImageIcon("/EqGenerator/image/xorGate16.png"));
  20. this.setText(obj.Attributs);
  21. }
  22. }
  23. return this;
  24. }
  25.  
  26. public class DTOObjectwithAttributes
  27. {
  28. /**
  29. * Paramètres
  30. */
  31.  
  32. boolean isFolder;
  33. boolean isXor;
  34. String Attributs;
  35.  
  36.  
  37. /**
  38. * Constructeurs
  39. * @param n2
  40. * @param attributs
  41. * @param isOrange
  42. */
  43. protected DTOObjectwithAttributes(boolean isFolder,boolean isXor, String attributs){
  44.  
  45. super();
  46. this.Attributs = attributs;
  47. this.isFolder=isFolder;
  48. this.isXor=isXor;
  49. }
  50.  
  51. public String toString() {
  52. return this.Attributs;
  53.  
  54. }
  55.  
  56. }
Add Comment
Please, Sign In to add comment