I have a frame with some components and a menu. Certain buttons on the frame and in the menu open a JFileChooser (a new instance each time) to open and save files.
My problem is simple, whenever I open a JFileChooser in Java and press OK, the menu is hidden behind the other controls in the frame. This means that when I open the menu, some menu items cannot be displayed.
However, if I don't press OK in the JFileChooser but press cancel, this doens't happen. I assume there is some error in how the frame is repainted after the FileChooser get an "OK". As I said, the stacking of components seems to be faulty.
I didn't mix Swing and AWT components by the way. All my components are Swing components.
EDIT: Here is my code
final JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File(Books.getDirectory()));
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setFileFilter(new XmlFilter());
int returnVal = fileChooser.showOpenDialog(Main.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
// OK was pressed
}
Any ideas?