public class saveButtonListener implements ActionListener{
public void actionPerformed(ActionEvent ev){
JFileChooser chooser= new JFileChooser();
String s=(String)searchedResultArea.getSelectedValue();// ???
}
}
Object s=searchedResultArea.getSelectedValue();
I have developed a program that saves the filename of the some pictures that user specifies on a file and displays them in a JList. I have save them in this format
E:\something\something\something.jpg
Now I need to open that picture using this value. My problem is that I am not able to convert this String into proper file naming that java uses like
E:\\something\\something\\something.jpg
I hope you got the point. I need two backslashes. How do I do it?
“\” is used to escape “\” character in source code. Path separator on Windiows is still “\”. If you got path from user input, then nothing to do here.