質問編集履歴
4
JAVAコード→JAVAに修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,571 +1,571 @@
|
|
1
|
+
```JAVA
|
2
|
+
|
3
|
+
public class TEST1 extends JFrame implements ListSelectionListener {
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
JList lst0;
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
public TEST1() throws Exception {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
setSize(1300, 750);
|
20
|
+
|
21
|
+
setLayout(null);
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
// ボタンの設置
|
26
|
+
|
27
|
+
button_sakusei();
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
// 画面作成
|
32
|
+
|
33
|
+
gamen_sakusei();
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
// 空のリストボックスの作成
|
38
|
+
|
39
|
+
list_sakusei();
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
// 表示する
|
44
|
+
|
45
|
+
setVisible(true);
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
//空のリストボックス作成
|
56
|
+
|
57
|
+
public void list_sakusei() {
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
lst0 = new JList(file_name2);
|
62
|
+
|
63
|
+
lst0.addListSelectionListener(this);
|
64
|
+
|
65
|
+
lst0.setCellRenderer(new StripedListCellRenderer());
|
66
|
+
|
67
|
+
JScrollPane lst1 = new JScrollPane(lst0);
|
68
|
+
|
69
|
+
lst1.setBounds(240, 150, 470,400);
|
70
|
+
|
71
|
+
getContentPane().add(lst1);
|
72
|
+
|
73
|
+
setVisible(true);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
public void valueChanged(ListSelectionEvent e) {
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
// 初期化
|
88
|
+
|
89
|
+
for(int i=0;i<5000;i++) {
|
90
|
+
|
91
|
+
new_flag[i]=0;
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
JList lst0 = (JList)e.getSource();
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
if(lst0.getSelectedValue()!="") {
|
102
|
+
|
103
|
+
if(lst0.getSelectedValue()!=null) {
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
Object lst = lst0.getSelectedValue() ;
|
108
|
+
|
109
|
+
sentaku_str = lst.toString();
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
//フォルダの一覧を抽出する
|
114
|
+
|
115
|
+
File file2 = new File(str_saki2);
|
116
|
+
|
117
|
+
if(!file2.isDirectory()) return;
|
118
|
+
|
119
|
+
File files[] = file2.listFiles();
|
120
|
+
|
121
|
+
file_name = new String[files.length];
|
122
|
+
|
123
|
+
for (int i=0; i<files.length; i++) {
|
124
|
+
|
125
|
+
file_name[i] = files[i].getName();
|
126
|
+
|
127
|
+
File item = files[i];
|
128
|
+
|
129
|
+
if(item.isDirectory()) {
|
130
|
+
|
131
|
+
folder[i] = item.getName();
|
132
|
+
|
133
|
+
//System.out.println("folder[i]:" + folder[i]);
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
if (item.isFile()) {
|
138
|
+
|
139
|
+
name[i] = item.getName();
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
//lst0.setListData(file_name);
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
for (int i=0; i<files.length; i++) {
|
152
|
+
|
153
|
+
// フォルダだったら下位フォルダを表示する
|
154
|
+
|
155
|
+
//ファイルだったら開く
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
//フォルダの一覧を抽出する
|
162
|
+
|
163
|
+
File file22 = new File(str_saki2);
|
164
|
+
|
165
|
+
if(!file22.isDirectory()) return;
|
166
|
+
|
167
|
+
File files23[] = file22.listFiles();
|
168
|
+
|
169
|
+
file_name = new String[files23.length];
|
170
|
+
|
171
|
+
for (int i=0; i<files23.length; i++) {
|
172
|
+
|
173
|
+
file_name[i] = files23[i].getName();
|
174
|
+
|
175
|
+
File item = files23[i];
|
176
|
+
|
177
|
+
if(item.isDirectory()) {
|
178
|
+
|
179
|
+
folder[i] = item.getName();
|
180
|
+
|
181
|
+
//System.out.println("folder[i]:" + folder[i]);
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
if (item.isFile()) {
|
186
|
+
|
187
|
+
name[i] = item.getName();
|
188
|
+
|
189
|
+
//System.out.println("name[i]:" + name[i]);
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
lst0.setListData(file_name);
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
try {
|
200
|
+
|
201
|
+
folder_new_check();
|
202
|
+
|
203
|
+
} catch (Exception e2) {
|
204
|
+
|
205
|
+
e2.printStackTrace();
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
lst0.clearSelection();
|
214
|
+
|
215
|
+
lst0.getSelectionModel().setAnchorSelectionIndex(-1);
|
216
|
+
|
217
|
+
lst0.getSelectionModel().setLeadSelectionIndex(-1);
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
// 画面作成メソッド
|
226
|
+
|
227
|
+
public void gamen_sakusei() {
|
228
|
+
|
229
|
+
//背景色の設定
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
// リストボックスのNEWファイルを赤で表示する
|
240
|
+
|
241
|
+
public class StripedListCellRenderer extends DefaultListCellRenderer {
|
242
|
+
|
243
|
+
public Component getListCellRendererComponent(JList list, Object value,
|
244
|
+
|
245
|
+
int index, boolean isSelected, boolean cellHasFocus) {
|
246
|
+
|
247
|
+
JLabel label = (JLabel) super.getListCellRendererComponent(list, value,index, isSelected, cellHasFocus);
|
248
|
+
|
249
|
+
if (new_flag[index] == 1) {
|
250
|
+
|
251
|
+
label.setForeground(Color.red);
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
return label;
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
public void folder_new_check() throws Exception {
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
//フォルダの一覧を抽出する
|
270
|
+
|
271
|
+
File file22 = new File(str_pass[1]);
|
272
|
+
|
273
|
+
File files23[] = file22.listFiles();
|
274
|
+
|
275
|
+
file_name = new String[files23.length];
|
276
|
+
|
277
|
+
for (int i=0; i<files23.length; i++) {
|
278
|
+
|
279
|
+
file_name[i] = files23[i].getName();
|
280
|
+
|
281
|
+
File item = files23[i];
|
282
|
+
|
283
|
+
if(item.isDirectory()) {
|
284
|
+
|
285
|
+
folder[i] = item.getName();
|
286
|
+
|
287
|
+
//System.out.println("folder[i]:" + folder[i]);
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
if (item.isFile()) {
|
292
|
+
|
293
|
+
name[i] = item.getName();
|
294
|
+
|
295
|
+
//System.out.println("name[i]:" + name[i]);
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
for(int i=0;i<new_cou[0];i++) {
|
304
|
+
|
305
|
+
file_name3[i] = new_file[i].substring(5);
|
306
|
+
|
307
|
+
String sarch2 = "\";
|
308
|
+
|
309
|
+
int result = file_name3[i].indexOf(sarch2);
|
310
|
+
|
311
|
+
if (result != -1) {
|
312
|
+
|
313
|
+
kiridashi = file_name3[i].substring(0,result);
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
for(int j=0;j<files23.length; j++) {
|
318
|
+
|
319
|
+
if(folder[j].equals(kiridashi)) {
|
320
|
+
|
321
|
+
new_flag[j]=1;
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
// 初期化
|
334
|
+
|
335
|
+
public static void initialaize() {
|
336
|
+
|
337
|
+
}
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
public static void main(String[] args) throws Exception {
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
NEW_FILE_SEARCH.new_file_search(new_file,koushinbi,new_cou,cou_folde,cou_file,str_pass,folde_name_new,file_name_new);
|
348
|
+
|
349
|
+
new DMSZUMEN();
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
}
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
public class NEW_FILE_SEARCH{
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
public static void new_file_search(String new_file[],int koushinbi[],int new_cou[],int cou_folde[],int cou_file[],String str_pass[],String folde_name_new[][],String file_name_new[][]) throws Exception {
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
String format2;
|
374
|
+
|
375
|
+
String format3;
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
// 初期化
|
380
|
+
|
381
|
+
for(int i=1;i<=5;i++) {
|
382
|
+
|
383
|
+
cou_folde[i] = 0;
|
384
|
+
|
385
|
+
cou_file[i] = 0;
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
String strmoto = str_pass[2] + "\";
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
// 1階層目チェック
|
398
|
+
|
399
|
+
File file_1 = new File(strmoto);
|
400
|
+
|
401
|
+
File files_1[] = file_1.listFiles();
|
402
|
+
|
403
|
+
for (int i=0; i<files_1.length; i++) {
|
404
|
+
|
405
|
+
File item = files_1[i];
|
406
|
+
|
407
|
+
// 階層のフォルダ名を取得
|
408
|
+
|
409
|
+
if(item.isDirectory()) {
|
410
|
+
|
411
|
+
folde_name_new[1][cou_folde[1]] = item.getName();
|
412
|
+
|
413
|
+
//System.out.println("folde_name_new[1][cou_folde[1]]:" + folde_name_new[1][cou_folde[1]]);
|
414
|
+
|
415
|
+
cou_folde[1] = cou_folde[1] + 1;
|
416
|
+
|
417
|
+
}
|
418
|
+
|
419
|
+
// 階層のファイル名を取得
|
420
|
+
|
421
|
+
if (item.isFile()) {
|
422
|
+
|
423
|
+
file_name_new[1][cou_file[1]] = item.getName();
|
424
|
+
|
425
|
+
cou_file[1] = cou_file[1] + 1;
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
}
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
// 2階層目以降チェック
|
436
|
+
|
437
|
+
for(int k=1;k<6;k++) {
|
438
|
+
|
439
|
+
for (int i = 0;i<cou_folde[k];i++) {
|
440
|
+
|
441
|
+
File file_2 = new File(strmoto + folde_name_new[k][i]);
|
442
|
+
|
443
|
+
File files_2[] = file_2.listFiles();
|
444
|
+
|
445
|
+
for (int j=0; j<files_2.length; j++) {
|
446
|
+
|
447
|
+
File item = files_2[j];
|
448
|
+
|
449
|
+
// 階層のフォルダ名を取得
|
450
|
+
|
451
|
+
if(item.isDirectory()) {
|
452
|
+
|
453
|
+
folde_name_new[k+1][cou_folde[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
454
|
+
|
455
|
+
//System.out.println("folde_name_new[k+1][cou_folde[k+1]]:" + folde_name_new[k+1][cou_folde[k+1]]);
|
456
|
+
|
457
|
+
cou_folde[k+1] = cou_folde[k+1] + 1;
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
// 階層のファイル名を取得
|
462
|
+
|
463
|
+
if (item.isFile()) {
|
464
|
+
|
465
|
+
file_name_new[k+1][cou_file[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
466
|
+
|
467
|
+
//System.out.println("file_name_new[k+1][cou_file[k+1]]:" + file_name_new[k+1][cou_file[k+1]]);
|
468
|
+
|
469
|
+
cou_file[k+1] = cou_file[k+1] + 1;
|
470
|
+
|
471
|
+
}
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
}
|
476
|
+
|
477
|
+
} // 2階層目以降チェック終わり
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
new_cou[0] = 0;
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
for(int i=2;i<6;i++) {
|
486
|
+
|
487
|
+
for(int j=0;j<cou_file[i];j++) {
|
488
|
+
|
489
|
+
File file200 = new File(strmoto + file_name_new[i][j]);
|
490
|
+
|
491
|
+
long lastModified = file200.lastModified();
|
492
|
+
|
493
|
+
Date date = new Date(lastModified);
|
494
|
+
|
495
|
+
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
496
|
+
|
497
|
+
format2 = sdf.format(date.getTime());
|
498
|
+
|
499
|
+
Calendar calendar = Calendar.getInstance();
|
500
|
+
|
501
|
+
calendar.setTime(date);
|
502
|
+
|
503
|
+
calendar.add(Calendar.DAY_OF_MONTH, +koushinbi[0]);// 直近1ヶ月
|
504
|
+
|
505
|
+
//calendar.add(Calendar.MONTH, +koushinbi[0]);// 直近1ヶ月
|
506
|
+
|
507
|
+
Date d1 = calendar.getTime();
|
508
|
+
|
509
|
+
Date date2 = new Date();
|
510
|
+
|
511
|
+
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
|
512
|
+
|
513
|
+
format3 = sdf2.format(date2.getTime());
|
514
|
+
|
515
|
+
Calendar calendar2 = Calendar.getInstance();
|
516
|
+
|
517
|
+
calendar2.setTime(date2);
|
518
|
+
|
519
|
+
if(d1.compareTo(date2) == -1){
|
520
|
+
|
521
|
+
}else {
|
522
|
+
|
523
|
+
new_file[new_cou[0]] = file_name_new[i][j];
|
524
|
+
|
525
|
+
new_cou[0] = new_cou[0] + 1;
|
526
|
+
|
527
|
+
}
|
528
|
+
|
529
|
+
}
|
530
|
+
|
531
|
+
}
|
532
|
+
|
533
|
+
}ファイルの最終更新日確認処理
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
}
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
```![イメージ説明](c689c5b6a6d23aad7f9258c5c5cee590.jpeg)
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
社内のサーバーのファイルを閲覧し、リストボックスに表示するようにしました。
|
550
|
+
|
551
|
+
ファイルの更新日が直近30日以内のフォルダ/ファイルはリストボックスで赤字になるように設定しましたが、
|
552
|
+
|
553
|
+
「テスト2」フォルダが黒字になってしまいます。(テスト2はテストをそのままコピーしてます。)
|
554
|
+
|
555
|
+
文字数制限があるため、一部消去&他classのコードは入れておりませんが、今回の件とは関係ないと思います。
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
リストボックス上でクリックしたままだと赤字ですが、クリックを離すと黒字になるため、indexが上手く
|
560
|
+
|
561
|
+
操作出来ていないと思いますが、どのように修正すればよいか分かりません。
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
宜しくお願い致します。
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
1
571
|
```JAVAコード
|
2
|
-
|
3
|
-
public class TEST1 extends JFrame implements ListSelectionListener {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
JList lst0;
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
public TEST1() throws Exception {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
setSize(1300, 750);
|
20
|
-
|
21
|
-
setLayout(null);
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
// ボタンの設置
|
26
|
-
|
27
|
-
button_sakusei();
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
// 画面作成
|
32
|
-
|
33
|
-
gamen_sakusei();
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
// 空のリストボックスの作成
|
38
|
-
|
39
|
-
list_sakusei();
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
// 表示する
|
44
|
-
|
45
|
-
setVisible(true);
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
//空のリストボックス作成
|
56
|
-
|
57
|
-
public void list_sakusei() {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
lst0 = new JList(file_name2);
|
62
|
-
|
63
|
-
lst0.addListSelectionListener(this);
|
64
|
-
|
65
|
-
lst0.setCellRenderer(new StripedListCellRenderer());
|
66
|
-
|
67
|
-
JScrollPane lst1 = new JScrollPane(lst0);
|
68
|
-
|
69
|
-
lst1.setBounds(240, 150, 470,400);
|
70
|
-
|
71
|
-
getContentPane().add(lst1);
|
72
|
-
|
73
|
-
setVisible(true);
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
public void valueChanged(ListSelectionEvent e) {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
// 初期化
|
88
|
-
|
89
|
-
for(int i=0;i<5000;i++) {
|
90
|
-
|
91
|
-
new_flag[i]=0;
|
92
|
-
|
93
|
-
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
JList lst0 = (JList)e.getSource();
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if(lst0.getSelectedValue()!="") {
|
102
|
-
|
103
|
-
if(lst0.getSelectedValue()!=null) {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
Object lst = lst0.getSelectedValue() ;
|
108
|
-
|
109
|
-
sentaku_str = lst.toString();
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
//フォルダの一覧を抽出する
|
114
|
-
|
115
|
-
File file2 = new File(str_saki2);
|
116
|
-
|
117
|
-
if(!file2.isDirectory()) return;
|
118
|
-
|
119
|
-
File files[] = file2.listFiles();
|
120
|
-
|
121
|
-
file_name = new String[files.length];
|
122
|
-
|
123
|
-
for (int i=0; i<files.length; i++) {
|
124
|
-
|
125
|
-
file_name[i] = files[i].getName();
|
126
|
-
|
127
|
-
File item = files[i];
|
128
|
-
|
129
|
-
if(item.isDirectory()) {
|
130
|
-
|
131
|
-
folder[i] = item.getName();
|
132
|
-
|
133
|
-
//System.out.println("folder[i]:" + folder[i]);
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
if (item.isFile()) {
|
138
|
-
|
139
|
-
name[i] = item.getName();
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
}
|
144
|
-
|
145
|
-
//lst0.setListData(file_name);
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
for (int i=0; i<files.length; i++) {
|
152
|
-
|
153
|
-
// フォルダだったら下位フォルダを表示する
|
154
|
-
|
155
|
-
//ファイルだったら開く
|
156
|
-
|
157
|
-
}
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
//フォルダの一覧を抽出する
|
162
|
-
|
163
|
-
File file22 = new File(str_saki2);
|
164
|
-
|
165
|
-
if(!file22.isDirectory()) return;
|
166
|
-
|
167
|
-
File files23[] = file22.listFiles();
|
168
|
-
|
169
|
-
file_name = new String[files23.length];
|
170
|
-
|
171
|
-
for (int i=0; i<files23.length; i++) {
|
172
|
-
|
173
|
-
file_name[i] = files23[i].getName();
|
174
|
-
|
175
|
-
File item = files23[i];
|
176
|
-
|
177
|
-
if(item.isDirectory()) {
|
178
|
-
|
179
|
-
folder[i] = item.getName();
|
180
|
-
|
181
|
-
//System.out.println("folder[i]:" + folder[i]);
|
182
|
-
|
183
|
-
}
|
184
|
-
|
185
|
-
if (item.isFile()) {
|
186
|
-
|
187
|
-
name[i] = item.getName();
|
188
|
-
|
189
|
-
//System.out.println("name[i]:" + name[i]);
|
190
|
-
|
191
|
-
}
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
lst0.setListData(file_name);
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
try {
|
200
|
-
|
201
|
-
folder_new_check();
|
202
|
-
|
203
|
-
} catch (Exception e2) {
|
204
|
-
|
205
|
-
e2.printStackTrace();
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
}
|
210
|
-
|
211
|
-
}
|
212
|
-
|
213
|
-
lst0.clearSelection();
|
214
|
-
|
215
|
-
lst0.getSelectionModel().setAnchorSelectionIndex(-1);
|
216
|
-
|
217
|
-
lst0.getSelectionModel().setLeadSelectionIndex(-1);
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
// 画面作成メソッド
|
226
|
-
|
227
|
-
public void gamen_sakusei() {
|
228
|
-
|
229
|
-
//背景色の設定
|
230
|
-
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
// リストボックスのNEWファイルを赤で表示する
|
240
|
-
|
241
|
-
public class StripedListCellRenderer extends DefaultListCellRenderer {
|
242
|
-
|
243
|
-
public Component getListCellRendererComponent(JList list, Object value,
|
244
|
-
|
245
|
-
int index, boolean isSelected, boolean cellHasFocus) {
|
246
|
-
|
247
|
-
JLabel label = (JLabel) super.getListCellRendererComponent(list, value,index, isSelected, cellHasFocus);
|
248
|
-
|
249
|
-
if (new_flag[index] == 1) {
|
250
|
-
|
251
|
-
label.setForeground(Color.red);
|
252
|
-
|
253
|
-
}
|
254
|
-
|
255
|
-
return label;
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
}
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
public void folder_new_check() throws Exception {
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
//フォルダの一覧を抽出する
|
270
|
-
|
271
|
-
File file22 = new File(str_pass[1]);
|
272
|
-
|
273
|
-
File files23[] = file22.listFiles();
|
274
|
-
|
275
|
-
file_name = new String[files23.length];
|
276
|
-
|
277
|
-
for (int i=0; i<files23.length; i++) {
|
278
|
-
|
279
|
-
file_name[i] = files23[i].getName();
|
280
|
-
|
281
|
-
File item = files23[i];
|
282
|
-
|
283
|
-
if(item.isDirectory()) {
|
284
|
-
|
285
|
-
folder[i] = item.getName();
|
286
|
-
|
287
|
-
//System.out.println("folder[i]:" + folder[i]);
|
288
|
-
|
289
|
-
}
|
290
|
-
|
291
|
-
if (item.isFile()) {
|
292
|
-
|
293
|
-
name[i] = item.getName();
|
294
|
-
|
295
|
-
//System.out.println("name[i]:" + name[i]);
|
296
|
-
|
297
|
-
}
|
298
|
-
|
299
|
-
}
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
for(int i=0;i<new_cou[0];i++) {
|
304
|
-
|
305
|
-
file_name3[i] = new_file[i].substring(5);
|
306
|
-
|
307
|
-
String sarch2 = "\";
|
308
|
-
|
309
|
-
int result = file_name3[i].indexOf(sarch2);
|
310
|
-
|
311
|
-
if (result != -1) {
|
312
|
-
|
313
|
-
kiridashi = file_name3[i].substring(0,result);
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
for(int j=0;j<files23.length; j++) {
|
318
|
-
|
319
|
-
if(folder[j].equals(kiridashi)) {
|
320
|
-
|
321
|
-
new_flag[j]=1;
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
}
|
326
|
-
|
327
|
-
}
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
// 初期化
|
334
|
-
|
335
|
-
public static void initialaize() {
|
336
|
-
|
337
|
-
}
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
public static void main(String[] args) throws Exception {
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
NEW_FILE_SEARCH.new_file_search(new_file,koushinbi,new_cou,cou_folde,cou_file,str_pass,folde_name_new,file_name_new);
|
348
|
-
|
349
|
-
new DMSZUMEN();
|
350
|
-
|
351
|
-
}
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
}
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
public class NEW_FILE_SEARCH{
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
public static void new_file_search(String new_file[],int koushinbi[],int new_cou[],int cou_folde[],int cou_file[],String str_pass[],String folde_name_new[][],String file_name_new[][]) throws Exception {
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
String format2;
|
374
|
-
|
375
|
-
String format3;
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
// 初期化
|
380
|
-
|
381
|
-
for(int i=1;i<=5;i++) {
|
382
|
-
|
383
|
-
cou_folde[i] = 0;
|
384
|
-
|
385
|
-
cou_file[i] = 0;
|
386
|
-
|
387
|
-
}
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
String strmoto = str_pass[2] + "\";
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
// 1階層目チェック
|
398
|
-
|
399
|
-
File file_1 = new File(strmoto);
|
400
|
-
|
401
|
-
File files_1[] = file_1.listFiles();
|
402
|
-
|
403
|
-
for (int i=0; i<files_1.length; i++) {
|
404
|
-
|
405
|
-
File item = files_1[i];
|
406
|
-
|
407
|
-
// 階層のフォルダ名を取得
|
408
|
-
|
409
|
-
if(item.isDirectory()) {
|
410
|
-
|
411
|
-
folde_name_new[1][cou_folde[1]] = item.getName();
|
412
|
-
|
413
|
-
//System.out.println("folde_name_new[1][cou_folde[1]]:" + folde_name_new[1][cou_folde[1]]);
|
414
|
-
|
415
|
-
cou_folde[1] = cou_folde[1] + 1;
|
416
|
-
|
417
|
-
}
|
418
|
-
|
419
|
-
// 階層のファイル名を取得
|
420
|
-
|
421
|
-
if (item.isFile()) {
|
422
|
-
|
423
|
-
file_name_new[1][cou_file[1]] = item.getName();
|
424
|
-
|
425
|
-
cou_file[1] = cou_file[1] + 1;
|
426
|
-
|
427
|
-
}
|
428
|
-
|
429
|
-
}
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
// 2階層目以降チェック
|
436
|
-
|
437
|
-
for(int k=1;k<6;k++) {
|
438
|
-
|
439
|
-
for (int i = 0;i<cou_folde[k];i++) {
|
440
|
-
|
441
|
-
File file_2 = new File(strmoto + folde_name_new[k][i]);
|
442
|
-
|
443
|
-
File files_2[] = file_2.listFiles();
|
444
|
-
|
445
|
-
for (int j=0; j<files_2.length; j++) {
|
446
|
-
|
447
|
-
File item = files_2[j];
|
448
|
-
|
449
|
-
// 階層のフォルダ名を取得
|
450
|
-
|
451
|
-
if(item.isDirectory()) {
|
452
|
-
|
453
|
-
folde_name_new[k+1][cou_folde[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
454
|
-
|
455
|
-
//System.out.println("folde_name_new[k+1][cou_folde[k+1]]:" + folde_name_new[k+1][cou_folde[k+1]]);
|
456
|
-
|
457
|
-
cou_folde[k+1] = cou_folde[k+1] + 1;
|
458
|
-
|
459
|
-
}
|
460
|
-
|
461
|
-
// 階層のファイル名を取得
|
462
|
-
|
463
|
-
if (item.isFile()) {
|
464
|
-
|
465
|
-
file_name_new[k+1][cou_file[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
466
|
-
|
467
|
-
//System.out.println("file_name_new[k+1][cou_file[k+1]]:" + file_name_new[k+1][cou_file[k+1]]);
|
468
|
-
|
469
|
-
cou_file[k+1] = cou_file[k+1] + 1;
|
470
|
-
|
471
|
-
}
|
472
|
-
|
473
|
-
}
|
474
|
-
|
475
|
-
}
|
476
|
-
|
477
|
-
} // 2階層目以降チェック終わり
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
new_cou[0] = 0;
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
for(int i=2;i<6;i++) {
|
486
|
-
|
487
|
-
for(int j=0;j<cou_file[i];j++) {
|
488
|
-
|
489
|
-
File file200 = new File(strmoto + file_name_new[i][j]);
|
490
|
-
|
491
|
-
long lastModified = file200.lastModified();
|
492
|
-
|
493
|
-
Date date = new Date(lastModified);
|
494
|
-
|
495
|
-
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
496
|
-
|
497
|
-
format2 = sdf.format(date.getTime());
|
498
|
-
|
499
|
-
Calendar calendar = Calendar.getInstance();
|
500
|
-
|
501
|
-
calendar.setTime(date);
|
502
|
-
|
503
|
-
calendar.add(Calendar.DAY_OF_MONTH, +koushinbi[0]);// 直近1ヶ月
|
504
|
-
|
505
|
-
//calendar.add(Calendar.MONTH, +koushinbi[0]);// 直近1ヶ月
|
506
|
-
|
507
|
-
Date d1 = calendar.getTime();
|
508
|
-
|
509
|
-
Date date2 = new Date();
|
510
|
-
|
511
|
-
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
|
512
|
-
|
513
|
-
format3 = sdf2.format(date2.getTime());
|
514
|
-
|
515
|
-
Calendar calendar2 = Calendar.getInstance();
|
516
|
-
|
517
|
-
calendar2.setTime(date2);
|
518
|
-
|
519
|
-
if(d1.compareTo(date2) == -1){
|
520
|
-
|
521
|
-
}else {
|
522
|
-
|
523
|
-
new_file[new_cou[0]] = file_name_new[i][j];
|
524
|
-
|
525
|
-
new_cou[0] = new_cou[0] + 1;
|
526
|
-
|
527
|
-
}
|
528
|
-
|
529
|
-
}
|
530
|
-
|
531
|
-
}
|
532
|
-
|
533
|
-
}ファイルの最終更新日確認処理
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
}
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
```![イメージ説明](c689c5b6a6d23aad7f9258c5c5cee590.jpeg)
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
社内のサーバーのファイルを閲覧し、リストボックスに表示するようにしました。
|
550
|
-
|
551
|
-
ファイルの更新日が直近30日以内のフォルダ/ファイルはリストボックスで赤字になるように設定しましたが、
|
552
|
-
|
553
|
-
「テスト2」フォルダが黒字になってしまいます。(テスト2はテストをそのままコピーしてます。)
|
554
|
-
|
555
|
-
文字数制限があるため、一部消去&他classのコードは入れておりませんが、今回の件とは関係ないと思います。
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
リストボックス上でクリックしたままだと赤字ですが、クリックを離すと黒字になるため、indexが上手く
|
560
|
-
|
561
|
-
操作出来ていないと思いますが、どのように修正すればよいか分かりません。
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
宜しくお願い致します。
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
```JAVAコード
|
3
<code>に正しく挿入した
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,548 @@
|
|
1
|
-
|
1
|
+
```JAVAコード
|
2
|
+
|
3
|
+
public class TEST1 extends JFrame implements ListSelectionListener {
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
JList lst0;
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
public TEST1() throws Exception {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
setSize(1300, 750);
|
20
|
+
|
21
|
+
setLayout(null);
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
// ボタンの設置
|
26
|
+
|
27
|
+
button_sakusei();
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
// 画面作成
|
32
|
+
|
33
|
+
gamen_sakusei();
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
// 空のリストボックスの作成
|
38
|
+
|
39
|
+
list_sakusei();
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
// 表示する
|
44
|
+
|
45
|
+
setVisible(true);
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
//空のリストボックス作成
|
56
|
+
|
57
|
+
public void list_sakusei() {
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
lst0 = new JList(file_name2);
|
62
|
+
|
63
|
+
lst0.addListSelectionListener(this);
|
64
|
+
|
65
|
+
lst0.setCellRenderer(new StripedListCellRenderer());
|
66
|
+
|
67
|
+
JScrollPane lst1 = new JScrollPane(lst0);
|
68
|
+
|
69
|
+
lst1.setBounds(240, 150, 470,400);
|
70
|
+
|
71
|
+
getContentPane().add(lst1);
|
72
|
+
|
73
|
+
setVisible(true);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
public void valueChanged(ListSelectionEvent e) {
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
// 初期化
|
88
|
+
|
89
|
+
for(int i=0;i<5000;i++) {
|
90
|
+
|
91
|
+
new_flag[i]=0;
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
JList lst0 = (JList)e.getSource();
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
if(lst0.getSelectedValue()!="") {
|
102
|
+
|
103
|
+
if(lst0.getSelectedValue()!=null) {
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
Object lst = lst0.getSelectedValue() ;
|
108
|
+
|
109
|
+
sentaku_str = lst.toString();
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
//フォルダの一覧を抽出する
|
114
|
+
|
115
|
+
File file2 = new File(str_saki2);
|
116
|
+
|
117
|
+
if(!file2.isDirectory()) return;
|
118
|
+
|
119
|
+
File files[] = file2.listFiles();
|
120
|
+
|
121
|
+
file_name = new String[files.length];
|
122
|
+
|
123
|
+
for (int i=0; i<files.length; i++) {
|
124
|
+
|
125
|
+
file_name[i] = files[i].getName();
|
126
|
+
|
127
|
+
File item = files[i];
|
128
|
+
|
129
|
+
if(item.isDirectory()) {
|
130
|
+
|
131
|
+
folder[i] = item.getName();
|
132
|
+
|
133
|
+
//System.out.println("folder[i]:" + folder[i]);
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
if (item.isFile()) {
|
138
|
+
|
139
|
+
name[i] = item.getName();
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
//lst0.setListData(file_name);
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
for (int i=0; i<files.length; i++) {
|
152
|
+
|
153
|
+
// フォルダだったら下位フォルダを表示する
|
154
|
+
|
155
|
+
//ファイルだったら開く
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
//フォルダの一覧を抽出する
|
162
|
+
|
163
|
+
File file22 = new File(str_saki2);
|
164
|
+
|
165
|
+
if(!file22.isDirectory()) return;
|
166
|
+
|
167
|
+
File files23[] = file22.listFiles();
|
168
|
+
|
169
|
+
file_name = new String[files23.length];
|
170
|
+
|
171
|
+
for (int i=0; i<files23.length; i++) {
|
172
|
+
|
173
|
+
file_name[i] = files23[i].getName();
|
174
|
+
|
175
|
+
File item = files23[i];
|
176
|
+
|
177
|
+
if(item.isDirectory()) {
|
178
|
+
|
179
|
+
folder[i] = item.getName();
|
180
|
+
|
181
|
+
//System.out.println("folder[i]:" + folder[i]);
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
if (item.isFile()) {
|
186
|
+
|
187
|
+
name[i] = item.getName();
|
188
|
+
|
189
|
+
//System.out.println("name[i]:" + name[i]);
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
lst0.setListData(file_name);
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
try {
|
200
|
+
|
201
|
+
folder_new_check();
|
202
|
+
|
203
|
+
} catch (Exception e2) {
|
204
|
+
|
205
|
+
e2.printStackTrace();
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
lst0.clearSelection();
|
214
|
+
|
215
|
+
lst0.getSelectionModel().setAnchorSelectionIndex(-1);
|
216
|
+
|
217
|
+
lst0.getSelectionModel().setLeadSelectionIndex(-1);
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
// 画面作成メソッド
|
226
|
+
|
227
|
+
public void gamen_sakusei() {
|
228
|
+
|
229
|
+
//背景色の設定
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
// リストボックスのNEWファイルを赤で表示する
|
240
|
+
|
241
|
+
public class StripedListCellRenderer extends DefaultListCellRenderer {
|
242
|
+
|
243
|
+
public Component getListCellRendererComponent(JList list, Object value,
|
244
|
+
|
245
|
+
int index, boolean isSelected, boolean cellHasFocus) {
|
246
|
+
|
247
|
+
JLabel label = (JLabel) super.getListCellRendererComponent(list, value,index, isSelected, cellHasFocus);
|
248
|
+
|
249
|
+
if (new_flag[index] == 1) {
|
250
|
+
|
251
|
+
label.setForeground(Color.red);
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
return label;
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
public void folder_new_check() throws Exception {
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
//フォルダの一覧を抽出する
|
270
|
+
|
271
|
+
File file22 = new File(str_pass[1]);
|
272
|
+
|
273
|
+
File files23[] = file22.listFiles();
|
274
|
+
|
275
|
+
file_name = new String[files23.length];
|
276
|
+
|
277
|
+
for (int i=0; i<files23.length; i++) {
|
278
|
+
|
279
|
+
file_name[i] = files23[i].getName();
|
280
|
+
|
281
|
+
File item = files23[i];
|
282
|
+
|
283
|
+
if(item.isDirectory()) {
|
284
|
+
|
285
|
+
folder[i] = item.getName();
|
286
|
+
|
287
|
+
//System.out.println("folder[i]:" + folder[i]);
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
if (item.isFile()) {
|
292
|
+
|
293
|
+
name[i] = item.getName();
|
294
|
+
|
295
|
+
//System.out.println("name[i]:" + name[i]);
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
for(int i=0;i<new_cou[0];i++) {
|
304
|
+
|
305
|
+
file_name3[i] = new_file[i].substring(5);
|
306
|
+
|
307
|
+
String sarch2 = "\";
|
308
|
+
|
309
|
+
int result = file_name3[i].indexOf(sarch2);
|
310
|
+
|
311
|
+
if (result != -1) {
|
312
|
+
|
313
|
+
kiridashi = file_name3[i].substring(0,result);
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
for(int j=0;j<files23.length; j++) {
|
318
|
+
|
319
|
+
if(folder[j].equals(kiridashi)) {
|
320
|
+
|
321
|
+
new_flag[j]=1;
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
// 初期化
|
334
|
+
|
335
|
+
public static void initialaize() {
|
336
|
+
|
337
|
+
}
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
public static void main(String[] args) throws Exception {
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
NEW_FILE_SEARCH.new_file_search(new_file,koushinbi,new_cou,cou_folde,cou_file,str_pass,folde_name_new,file_name_new);
|
348
|
+
|
349
|
+
new DMSZUMEN();
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
}
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
public class NEW_FILE_SEARCH{
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
public static void new_file_search(String new_file[],int koushinbi[],int new_cou[],int cou_folde[],int cou_file[],String str_pass[],String folde_name_new[][],String file_name_new[][]) throws Exception {
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
String format2;
|
374
|
+
|
375
|
+
String format3;
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
// 初期化
|
380
|
+
|
381
|
+
for(int i=1;i<=5;i++) {
|
382
|
+
|
383
|
+
cou_folde[i] = 0;
|
384
|
+
|
385
|
+
cou_file[i] = 0;
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
String strmoto = str_pass[2] + "\";
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
// 1階層目チェック
|
398
|
+
|
399
|
+
File file_1 = new File(strmoto);
|
400
|
+
|
401
|
+
File files_1[] = file_1.listFiles();
|
402
|
+
|
403
|
+
for (int i=0; i<files_1.length; i++) {
|
404
|
+
|
405
|
+
File item = files_1[i];
|
406
|
+
|
407
|
+
// 階層のフォルダ名を取得
|
408
|
+
|
409
|
+
if(item.isDirectory()) {
|
410
|
+
|
411
|
+
folde_name_new[1][cou_folde[1]] = item.getName();
|
412
|
+
|
413
|
+
//System.out.println("folde_name_new[1][cou_folde[1]]:" + folde_name_new[1][cou_folde[1]]);
|
414
|
+
|
415
|
+
cou_folde[1] = cou_folde[1] + 1;
|
416
|
+
|
417
|
+
}
|
418
|
+
|
419
|
+
// 階層のファイル名を取得
|
420
|
+
|
421
|
+
if (item.isFile()) {
|
422
|
+
|
423
|
+
file_name_new[1][cou_file[1]] = item.getName();
|
424
|
+
|
425
|
+
cou_file[1] = cou_file[1] + 1;
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
}
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
// 2階層目以降チェック
|
436
|
+
|
437
|
+
for(int k=1;k<6;k++) {
|
438
|
+
|
439
|
+
for (int i = 0;i<cou_folde[k];i++) {
|
440
|
+
|
441
|
+
File file_2 = new File(strmoto + folde_name_new[k][i]);
|
442
|
+
|
443
|
+
File files_2[] = file_2.listFiles();
|
444
|
+
|
445
|
+
for (int j=0; j<files_2.length; j++) {
|
446
|
+
|
447
|
+
File item = files_2[j];
|
448
|
+
|
449
|
+
// 階層のフォルダ名を取得
|
450
|
+
|
451
|
+
if(item.isDirectory()) {
|
452
|
+
|
453
|
+
folde_name_new[k+1][cou_folde[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
454
|
+
|
455
|
+
//System.out.println("folde_name_new[k+1][cou_folde[k+1]]:" + folde_name_new[k+1][cou_folde[k+1]]);
|
456
|
+
|
457
|
+
cou_folde[k+1] = cou_folde[k+1] + 1;
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
// 階層のファイル名を取得
|
462
|
+
|
463
|
+
if (item.isFile()) {
|
464
|
+
|
465
|
+
file_name_new[k+1][cou_file[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
466
|
+
|
467
|
+
//System.out.println("file_name_new[k+1][cou_file[k+1]]:" + file_name_new[k+1][cou_file[k+1]]);
|
468
|
+
|
469
|
+
cou_file[k+1] = cou_file[k+1] + 1;
|
470
|
+
|
471
|
+
}
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
}
|
476
|
+
|
477
|
+
} // 2階層目以降チェック終わり
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
new_cou[0] = 0;
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
for(int i=2;i<6;i++) {
|
486
|
+
|
487
|
+
for(int j=0;j<cou_file[i];j++) {
|
488
|
+
|
489
|
+
File file200 = new File(strmoto + file_name_new[i][j]);
|
490
|
+
|
491
|
+
long lastModified = file200.lastModified();
|
492
|
+
|
493
|
+
Date date = new Date(lastModified);
|
494
|
+
|
495
|
+
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
496
|
+
|
497
|
+
format2 = sdf.format(date.getTime());
|
498
|
+
|
499
|
+
Calendar calendar = Calendar.getInstance();
|
500
|
+
|
501
|
+
calendar.setTime(date);
|
502
|
+
|
503
|
+
calendar.add(Calendar.DAY_OF_MONTH, +koushinbi[0]);// 直近1ヶ月
|
504
|
+
|
505
|
+
//calendar.add(Calendar.MONTH, +koushinbi[0]);// 直近1ヶ月
|
506
|
+
|
507
|
+
Date d1 = calendar.getTime();
|
508
|
+
|
509
|
+
Date date2 = new Date();
|
510
|
+
|
511
|
+
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
|
512
|
+
|
513
|
+
format3 = sdf2.format(date2.getTime());
|
514
|
+
|
515
|
+
Calendar calendar2 = Calendar.getInstance();
|
516
|
+
|
517
|
+
calendar2.setTime(date2);
|
518
|
+
|
519
|
+
if(d1.compareTo(date2) == -1){
|
520
|
+
|
521
|
+
}else {
|
522
|
+
|
523
|
+
new_file[new_cou[0]] = file_name_new[i][j];
|
524
|
+
|
525
|
+
new_cou[0] = new_cou[0] + 1;
|
526
|
+
|
527
|
+
}
|
528
|
+
|
529
|
+
}
|
530
|
+
|
531
|
+
}
|
532
|
+
|
533
|
+
}ファイルの最終更新日確認処理
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
}
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
```![イメージ説明](c689c5b6a6d23aad7f9258c5c5cee590.jpeg)
|
2
546
|
|
3
547
|
|
4
548
|
|
@@ -25,539 +569,3 @@
|
|
25
569
|
|
26
570
|
|
27
571
|
```JAVAコード
|
28
|
-
|
29
|
-
public class TEST1 extends JFrame implements ListSelectionListener {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
JList lst0;
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
public TEST1() throws Exception {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
setSize(1300, 750);
|
46
|
-
|
47
|
-
setLayout(null);
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
// ボタンの設置
|
52
|
-
|
53
|
-
button_sakusei();
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
// 画面作成
|
58
|
-
|
59
|
-
gamen_sakusei();
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
// 空のリストボックスの作成
|
64
|
-
|
65
|
-
list_sakusei();
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
// 表示する
|
70
|
-
|
71
|
-
setVisible(true);
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
//空のリストボックス作成
|
82
|
-
|
83
|
-
public void list_sakusei() {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
lst0 = new JList(file_name2);
|
88
|
-
|
89
|
-
lst0.addListSelectionListener(this);
|
90
|
-
|
91
|
-
lst0.setCellRenderer(new StripedListCellRenderer());
|
92
|
-
|
93
|
-
JScrollPane lst1 = new JScrollPane(lst0);
|
94
|
-
|
95
|
-
lst1.setBounds(240, 150, 470,400);
|
96
|
-
|
97
|
-
getContentPane().add(lst1);
|
98
|
-
|
99
|
-
setVisible(true);
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
public void valueChanged(ListSelectionEvent e) {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
// 初期化
|
114
|
-
|
115
|
-
for(int i=0;i<5000;i++) {
|
116
|
-
|
117
|
-
new_flag[i]=0;
|
118
|
-
|
119
|
-
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
JList lst0 = (JList)e.getSource();
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
if(lst0.getSelectedValue()!="") {
|
128
|
-
|
129
|
-
if(lst0.getSelectedValue()!=null) {
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
Object lst = lst0.getSelectedValue() ;
|
134
|
-
|
135
|
-
sentaku_str = lst.toString();
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
//フォルダの一覧を抽出する
|
140
|
-
|
141
|
-
File file2 = new File(str_saki2);
|
142
|
-
|
143
|
-
if(!file2.isDirectory()) return;
|
144
|
-
|
145
|
-
File files[] = file2.listFiles();
|
146
|
-
|
147
|
-
file_name = new String[files.length];
|
148
|
-
|
149
|
-
for (int i=0; i<files.length; i++) {
|
150
|
-
|
151
|
-
file_name[i] = files[i].getName();
|
152
|
-
|
153
|
-
File item = files[i];
|
154
|
-
|
155
|
-
if(item.isDirectory()) {
|
156
|
-
|
157
|
-
folder[i] = item.getName();
|
158
|
-
|
159
|
-
//System.out.println("folder[i]:" + folder[i]);
|
160
|
-
|
161
|
-
}
|
162
|
-
|
163
|
-
if (item.isFile()) {
|
164
|
-
|
165
|
-
name[i] = item.getName();
|
166
|
-
|
167
|
-
}
|
168
|
-
|
169
|
-
}
|
170
|
-
|
171
|
-
//lst0.setListData(file_name);
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
for (int i=0; i<files.length; i++) {
|
178
|
-
|
179
|
-
// フォルダだったら下位フォルダを表示する
|
180
|
-
|
181
|
-
//ファイルだったら開く
|
182
|
-
|
183
|
-
}
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
//フォルダの一覧を抽出する
|
188
|
-
|
189
|
-
File file22 = new File(str_saki2);
|
190
|
-
|
191
|
-
if(!file22.isDirectory()) return;
|
192
|
-
|
193
|
-
File files23[] = file22.listFiles();
|
194
|
-
|
195
|
-
file_name = new String[files23.length];
|
196
|
-
|
197
|
-
for (int i=0; i<files23.length; i++) {
|
198
|
-
|
199
|
-
file_name[i] = files23[i].getName();
|
200
|
-
|
201
|
-
File item = files23[i];
|
202
|
-
|
203
|
-
if(item.isDirectory()) {
|
204
|
-
|
205
|
-
folder[i] = item.getName();
|
206
|
-
|
207
|
-
//System.out.println("folder[i]:" + folder[i]);
|
208
|
-
|
209
|
-
}
|
210
|
-
|
211
|
-
if (item.isFile()) {
|
212
|
-
|
213
|
-
name[i] = item.getName();
|
214
|
-
|
215
|
-
//System.out.println("name[i]:" + name[i]);
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
lst0.setListData(file_name);
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
try {
|
226
|
-
|
227
|
-
folder_new_check();
|
228
|
-
|
229
|
-
} catch (Exception e2) {
|
230
|
-
|
231
|
-
e2.printStackTrace();
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
}
|
236
|
-
|
237
|
-
}
|
238
|
-
|
239
|
-
lst0.clearSelection();
|
240
|
-
|
241
|
-
lst0.getSelectionModel().setAnchorSelectionIndex(-1);
|
242
|
-
|
243
|
-
lst0.getSelectionModel().setLeadSelectionIndex(-1);
|
244
|
-
|
245
|
-
}
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
// 画面作成メソッド
|
252
|
-
|
253
|
-
public void gamen_sakusei() {
|
254
|
-
|
255
|
-
//背景色の設定
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
// リストボックスのNEWファイルを赤で表示する
|
266
|
-
|
267
|
-
public class StripedListCellRenderer extends DefaultListCellRenderer {
|
268
|
-
|
269
|
-
public Component getListCellRendererComponent(JList list, Object value,
|
270
|
-
|
271
|
-
int index, boolean isSelected, boolean cellHasFocus) {
|
272
|
-
|
273
|
-
JLabel label = (JLabel) super.getListCellRendererComponent(list, value,index, isSelected, cellHasFocus);
|
274
|
-
|
275
|
-
if (new_flag[index] == 1) {
|
276
|
-
|
277
|
-
label.setForeground(Color.red);
|
278
|
-
|
279
|
-
}
|
280
|
-
|
281
|
-
return label;
|
282
|
-
|
283
|
-
}
|
284
|
-
|
285
|
-
}
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
public void folder_new_check() throws Exception {
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
//フォルダの一覧を抽出する
|
296
|
-
|
297
|
-
File file22 = new File(str_pass[1]);
|
298
|
-
|
299
|
-
File files23[] = file22.listFiles();
|
300
|
-
|
301
|
-
file_name = new String[files23.length];
|
302
|
-
|
303
|
-
for (int i=0; i<files23.length; i++) {
|
304
|
-
|
305
|
-
file_name[i] = files23[i].getName();
|
306
|
-
|
307
|
-
File item = files23[i];
|
308
|
-
|
309
|
-
if(item.isDirectory()) {
|
310
|
-
|
311
|
-
folder[i] = item.getName();
|
312
|
-
|
313
|
-
//System.out.println("folder[i]:" + folder[i]);
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
if (item.isFile()) {
|
318
|
-
|
319
|
-
name[i] = item.getName();
|
320
|
-
|
321
|
-
//System.out.println("name[i]:" + name[i]);
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
}
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
for(int i=0;i<new_cou[0];i++) {
|
330
|
-
|
331
|
-
file_name3[i] = new_file[i].substring(5);
|
332
|
-
|
333
|
-
String sarch2 = "\";
|
334
|
-
|
335
|
-
int result = file_name3[i].indexOf(sarch2);
|
336
|
-
|
337
|
-
if (result != -1) {
|
338
|
-
|
339
|
-
kiridashi = file_name3[i].substring(0,result);
|
340
|
-
|
341
|
-
}
|
342
|
-
|
343
|
-
for(int j=0;j<files23.length; j++) {
|
344
|
-
|
345
|
-
if(folder[j].equals(kiridashi)) {
|
346
|
-
|
347
|
-
new_flag[j]=1;
|
348
|
-
|
349
|
-
}
|
350
|
-
|
351
|
-
}
|
352
|
-
|
353
|
-
}
|
354
|
-
|
355
|
-
}
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
// 初期化
|
360
|
-
|
361
|
-
public static void initialaize() {
|
362
|
-
|
363
|
-
}
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
public static void main(String[] args) throws Exception {
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
NEW_FILE_SEARCH.new_file_search(new_file,koushinbi,new_cou,cou_folde,cou_file,str_pass,folde_name_new,file_name_new);
|
374
|
-
|
375
|
-
new DMSZUMEN();
|
376
|
-
|
377
|
-
}
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
}
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
public class NEW_FILE_SEARCH{
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
public static void new_file_search(String new_file[],int koushinbi[],int new_cou[],int cou_folde[],int cou_file[],String str_pass[],String folde_name_new[][],String file_name_new[][]) throws Exception {
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
String format2;
|
400
|
-
|
401
|
-
String format3;
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
// 初期化
|
406
|
-
|
407
|
-
for(int i=1;i<=5;i++) {
|
408
|
-
|
409
|
-
cou_folde[i] = 0;
|
410
|
-
|
411
|
-
cou_file[i] = 0;
|
412
|
-
|
413
|
-
}
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
String strmoto = str_pass[2] + "\";
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
// 1階層目チェック
|
424
|
-
|
425
|
-
File file_1 = new File(strmoto);
|
426
|
-
|
427
|
-
File files_1[] = file_1.listFiles();
|
428
|
-
|
429
|
-
for (int i=0; i<files_1.length; i++) {
|
430
|
-
|
431
|
-
File item = files_1[i];
|
432
|
-
|
433
|
-
// 階層のフォルダ名を取得
|
434
|
-
|
435
|
-
if(item.isDirectory()) {
|
436
|
-
|
437
|
-
folde_name_new[1][cou_folde[1]] = item.getName();
|
438
|
-
|
439
|
-
//System.out.println("folde_name_new[1][cou_folde[1]]:" + folde_name_new[1][cou_folde[1]]);
|
440
|
-
|
441
|
-
cou_folde[1] = cou_folde[1] + 1;
|
442
|
-
|
443
|
-
}
|
444
|
-
|
445
|
-
// 階層のファイル名を取得
|
446
|
-
|
447
|
-
if (item.isFile()) {
|
448
|
-
|
449
|
-
file_name_new[1][cou_file[1]] = item.getName();
|
450
|
-
|
451
|
-
cou_file[1] = cou_file[1] + 1;
|
452
|
-
|
453
|
-
}
|
454
|
-
|
455
|
-
}
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
// 2階層目以降チェック
|
462
|
-
|
463
|
-
for(int k=1;k<6;k++) {
|
464
|
-
|
465
|
-
for (int i = 0;i<cou_folde[k];i++) {
|
466
|
-
|
467
|
-
File file_2 = new File(strmoto + folde_name_new[k][i]);
|
468
|
-
|
469
|
-
File files_2[] = file_2.listFiles();
|
470
|
-
|
471
|
-
for (int j=0; j<files_2.length; j++) {
|
472
|
-
|
473
|
-
File item = files_2[j];
|
474
|
-
|
475
|
-
// 階層のフォルダ名を取得
|
476
|
-
|
477
|
-
if(item.isDirectory()) {
|
478
|
-
|
479
|
-
folde_name_new[k+1][cou_folde[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
480
|
-
|
481
|
-
//System.out.println("folde_name_new[k+1][cou_folde[k+1]]:" + folde_name_new[k+1][cou_folde[k+1]]);
|
482
|
-
|
483
|
-
cou_folde[k+1] = cou_folde[k+1] + 1;
|
484
|
-
|
485
|
-
}
|
486
|
-
|
487
|
-
// 階層のファイル名を取得
|
488
|
-
|
489
|
-
if (item.isFile()) {
|
490
|
-
|
491
|
-
file_name_new[k+1][cou_file[k+1]] = folde_name_new[k][i] + "\" + item.getName();
|
492
|
-
|
493
|
-
//System.out.println("file_name_new[k+1][cou_file[k+1]]:" + file_name_new[k+1][cou_file[k+1]]);
|
494
|
-
|
495
|
-
cou_file[k+1] = cou_file[k+1] + 1;
|
496
|
-
|
497
|
-
}
|
498
|
-
|
499
|
-
}
|
500
|
-
|
501
|
-
}
|
502
|
-
|
503
|
-
} // 2階層目以降チェック終わり
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
new_cou[0] = 0;
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
for(int i=2;i<6;i++) {
|
512
|
-
|
513
|
-
for(int j=0;j<cou_file[i];j++) {
|
514
|
-
|
515
|
-
File file200 = new File(strmoto + file_name_new[i][j]);
|
516
|
-
|
517
|
-
long lastModified = file200.lastModified();
|
518
|
-
|
519
|
-
Date date = new Date(lastModified);
|
520
|
-
|
521
|
-
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
522
|
-
|
523
|
-
format2 = sdf.format(date.getTime());
|
524
|
-
|
525
|
-
Calendar calendar = Calendar.getInstance();
|
526
|
-
|
527
|
-
calendar.setTime(date);
|
528
|
-
|
529
|
-
calendar.add(Calendar.DAY_OF_MONTH, +koushinbi[0]);// 直近1ヶ月
|
530
|
-
|
531
|
-
//calendar.add(Calendar.MONTH, +koushinbi[0]);// 直近1ヶ月
|
532
|
-
|
533
|
-
Date d1 = calendar.getTime();
|
534
|
-
|
535
|
-
Date date2 = new Date();
|
536
|
-
|
537
|
-
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
|
538
|
-
|
539
|
-
format3 = sdf2.format(date2.getTime());
|
540
|
-
|
541
|
-
Calendar calendar2 = Calendar.getInstance();
|
542
|
-
|
543
|
-
calendar2.setTime(date2);
|
544
|
-
|
545
|
-
if(d1.compareTo(date2) == -1){
|
546
|
-
|
547
|
-
}else {
|
548
|
-
|
549
|
-
new_file[new_cou[0]] = file_name_new[i][j];
|
550
|
-
|
551
|
-
new_cou[0] = new_cou[0] + 1;
|
552
|
-
|
553
|
-
}
|
554
|
-
|
555
|
-
}
|
556
|
-
|
557
|
-
}
|
558
|
-
|
559
|
-
}ファイルの最終更新日確認処理
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
}
|
2
画像の挿入
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
![イメージ説明](c689c5b6a6d23aad7f9258c5c5cee590.jpeg)
|
2
|
+
|
3
|
+
|
4
|
+
|
1
5
|
社内のサーバーのファイルを閲覧し、リストボックスに表示するようにしました。
|
2
6
|
|
3
7
|
ファイルの更新日が直近30日以内のフォルダ/ファイルはリストボックスで赤字になるように設定しましたが、
|
1
画像の挿入
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|