回答編集履歴
2
日付チェックをレンダラ側に移動
test
CHANGED
@@ -6,9 +6,7 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
日付のチェックは getListCellRendererComponent 内で fileItem.le
|
9
|
+
日付のチェックは getListCellRendererComponent 内で fileItem.lastModified.after(condition) として行っています.
|
10
|
-
|
11
|
-
fileItem クラスの lessThan メソッドは
|
12
10
|
|
13
11
|
```java
|
14
12
|
|
@@ -28,7 +26,7 @@
|
|
28
26
|
|
29
27
|
```
|
30
28
|
|
31
|
-
として現在日時から 30日を引いた Calendar を
|
29
|
+
として現在日時から 30日を引いた Calendar を比較しています.
|
32
30
|
|
33
31
|
このように表示の度にチェックしている為, フラグ等は要らなくなっています.
|
34
32
|
|
@@ -352,8 +350,6 @@
|
|
352
350
|
|
353
351
|
boolean isDirectory() { return file.isDirectory(); }
|
354
352
|
|
355
|
-
boolean lessThan(Calendar conditions) { return lastModified.after(conditions); }
|
356
|
-
|
357
353
|
@Override
|
358
354
|
|
359
355
|
public String toString() {
|
@@ -390,7 +386,7 @@
|
|
390
386
|
|
391
387
|
FileItem fileItem = (FileItem)value;
|
392
388
|
|
393
|
-
if(condition != null && fileItem.le
|
389
|
+
if(condition != null && fileItem.lastModified.after(condition)) { //更新日チェック
|
394
390
|
|
395
391
|
label.setForeground(foreground);
|
396
392
|
|
1
フォルダ表示時の■付加処理を移動
test
CHANGED
@@ -360,7 +360,9 @@
|
|
360
360
|
|
361
361
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
362
362
|
|
363
|
+
String iconDummy = (isDirectory() ? "■" : " ");
|
364
|
+
|
363
|
-
return file.getName() + " (" + dateFormat.format(new Date(file.lastModified())) + ")";
|
365
|
+
return iconDummy + " "+ file.getName() + " (" + dateFormat.format(new Date(file.lastModified())) + ")";
|
364
366
|
|
365
367
|
}
|
366
368
|
|
@@ -394,16 +396,6 @@
|
|
394
396
|
|
395
397
|
}
|
396
398
|
|
397
|
-
if(fileItem.isDirectory()) {//フォルダは
|
398
|
-
|
399
|
-
label.setText("■ "+value.toString());//先頭に■を追加(フォルダアイコンのつもり)
|
400
|
-
|
401
|
-
} else {//他は
|
402
|
-
|
403
|
-
label.setText(" "+value.toString());//名前の位置を合わせるため全角空白を追加
|
404
|
-
|
405
|
-
}
|
406
|
-
|
407
399
|
return label;
|
408
400
|
|
409
401
|
}
|