I seem to have a problem with my very simple implementation of a file chooser dialogue that requires me to minimize Netbeans each time in order to get to it, and it gets pretty frustrating specially now with testing.
I have seen a few solutions online including SO yet none seem to do the trick, while some other seem very lengthy and complicated for my current level.
private void fileSearch() {
JFileChooser fileSelect = new JFileChooser();
int returnVal = fileSelect.showOpenDialog(null);
String pathToFile;
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileSelect.getSelectedFile();
pathToFile = file.getAbsolutePath();
try {
P.binaryFileToHexString(pathToFile);
} catch (Exception e) {
System.out.print("Oops! there was an error there..." + e);
}
System.out.println("\nYou chose to open this file: " + file.getName());
}
}
Some of my try's include using;
.requestFocus();
.requestFocusInWindow();
.setVisible();
Is there a particular attribute/method I can set in order to solve the problem?