I read tutorial in File Browser Gui , but if the strucutre folder changed, program cannot dynamic reload, how to create refresh/reload function in File Browser GUI ?
Here my uncomplete code
refreshPath = new JButton("Refresh");
refreshPath.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae) {
....
}
});
toolBar.add(refreshPath);
FileIO is low level and hard event for Java and Native OS too
there are basically two ways
a) Watching a Directory for Changes for Java7, discussed here.
b) use some of custom
FileIO Watching (I can't suggest what's is better or not, maybeFileWatcher by Apache)in both cases nothing will be notified Swing GUI, have to notify by using
SwingWorkerorRunnable#Threadby using
Runnable#Threadins't there guarantee that output will be notifyiedEvent Dispatch Thread, have wrapping output to the Swing GUI to theinvokeLater()SwingWorkerguarantee that, but for safer output you can to useinvokeLater()too, we talking about 4th. short codelines moreover