tailieunhanh - Advanced Java 2 Platform HOW TO PROGRAM phần 2

lấy số chỉ mục của getIndexOfChild cho nút con int công cộng (đối tượng cha mẹ, đối tượng trẻ em) {/ / thư mục cha tập tin đối tượng = (File) mẹ; / / con tập tin tập tin đối tượng = (file) trẻ em; / / nhận được danh sách tập tin trong chuỗi thư mục [] children = (); / / danh sách tìm kiếm Tập cho con | Chapter 3 Model-View-Controller 125 59 if fileList null 60 return .length 61 62 63 return 0 childCount is 0 for files 64 65 66 return true if node is a file false if it is a directory 67 public boolean isLeaf Object node 68 69 File file File node 70 return 71 72 73 get numeric index of given child node 74 public int getIndexOfChild Object parent Object child 75 76 get parent File object 77 File directory File parent 78 79 get child File object 80 File file File child 81 82 get File list in directory 83 String children 84 85 search File list for given child 86 for int i 0 i i 87 88 if .equals children i 89 90 return matching File s index 91 return i 92 93 94 95 return -1 indicate child index not found 96 97 end method getIndexOfChild 98 99 invoked by delegate if value of Object at given 100 TreePath changes 101 public void valueForPathChanged TreePath path 102 Object value 103 104 get File object that was changed 105 File oldFile File 106 107 get parent directory of changed File 108 String fileParentPath 109 Fig. FileSystemModel implementation of interface TreeModel to represent a file system part 3 of 5 . 126 Model-View-Controller Chapter 3 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 get value of newFileName entered by user String newFileName String value create File object with newFileName for renaming oldFile File targetFile new File fileParentPath newFileName rename oldFile to targetFile targetFile get File object for parent directory File parent new File fileParentPath create int array for renamed File s index int changedChildrenIndices getIndexOfChild parent targetFile create Object array containing only renamed File Object changedChildren targetFile notify .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.