Hi,
I have a program that uses JButtons (under ActionEvent e) and the user clicks a button and it brings up the appropriate text file associated with that name. I have the files on a flash drive but every time i transfer the files to different computer and want to run the program on the computer, i need to change the file pathway. They are all loaded into my source package. Is there a way or code that I can have Java go into the source package to retrieve the files or to search for the files and set that pathway as a temporary string? If needed, i'll provide more code.
Thanks for your help!
JButton temp = (JButton) e.getSource();
File f = new File("J:\\AP Comp Sci\\Bible 2\\src\\bible2\\Books\\"
+ temp.getText() + ".txt");
Desktop desktop = Desktop.getDesktop();
try {
desktop.open(f);
} catch (Exception e1) {
System.out.println("error");
}