I am attempting to use a Java AWT FileDialog, but I want to replace the default Java Dialog icon with something else. In short, the code looks something like this:
Frame frame = new Frame();
Image image = ImageIO.read(new URL("file:/path/to/myfile.jpg"));
FileDialog fileDialog = new FileDialog(frame, "Save As", FileDialog.SAVE);
fileDialog.setIconImage(image);
fileDialog.setDirectory("/path/to/directory");
fileDialog.setFile("filename.txt");
fileDialog.setVisible(true);
I've tried several variation, including a different method of reading the image, packing the FileDialog, packing the Frame, setting the icon of the Frame, etc. However, regardless of what I try, the FileDialog icon never changes. When I set the icon of the Frame and set the Frame to visible, the frame displayed the correct icon, but it was still a no go for the FileDialog.
Any Thoughts?