After I start a FileChooser window in my javaFX application in windows the application icon in the taskbar shows a java icon and not the icon of the main window. Is there a possibility to select an application icon for a FileChooser instance?
It is possible to do so, but apparently only when you have a visible parent stage.
Provided that stage in the following example is visible, you can do this:
FileChooser fileChooser = new FileChooser();
File result = fileChooser.showSaveDialog(stage);
This opens the file chooser as a child of the given stage, which has the given icon.
I stepped through the JavaFX source code with a debugger (Oracle Java 8u72 on Windows x64), and there is not single point in the Java code where the icon could be set. The parent window handle is passed into a native method, where it then the icon probably gets resolved somewhere in the Win32 windowing code.
Asked in February 2016Viewed 2,588 timesVoted 8Answered 1 times