Notify a Button if the number of files in a directory change

前端 未结 2 1293
醉酒成梦
醉酒成梦 2021-01-21 15:51

I have a button that I want to disable as long as there isn\'t a specific number of files in a directory. Is there some kind of listener that notifies me at the moment a file i

2条回答
  •  攒了一身酷
    2021-01-21 16:08

    There's no current native support in Java for file system events and monitoring. JNotify is a useful library for doing this. You should set it up to monitor the directory for modifications, and then determine yourself what's been added/removed.

    Java 7 will have file system event support built into it.

提交回复
热议问题