I am a beginner in Java, so my question would be pretty basic. Here is my problem I have a class where I process folders for query matching and indexing.I have made a GUI for the same where I will ask the user to select the directory from JFileChooser.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
JFileChooser f=new JFileChooser();
f.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
f.showOpenDialog(null);
if(f.showOpenDialog(this)==JFileChooser.APPROVE_OPTION){
}
System.out.println(f.getSelectedFile().getAbsolutePath());
}
Now I want to give this directory path to my other class so it can process the folder
obj = new object();
boolean index = false;
String str = "";
InputStreamReader r = new InputStreamReader(System.in);
obj.dataDirectory = // here should be the path of the selected folder
For Example, if a user selects c:\Desktop\TextFiles then what I want want is obj.dataDirectory=c:\Desktop\TextFiles
I tried creating an object of GUI class in this class and then tried calling that method in this class but I don`t know how to do it exactly or even if it is possible.
Thanks in Advance