JavaFX Application Icon
I tried this and it totally works. The code is:
stage.getIcons().add(
new Image(
<yourclassname>.class.getResourceAsStream( "icon.png" )));
icon.png is under the same folder as the source files.
Assuming your stage is "stage" and the file is on the filesystem:
stage.getIcons().add(new Image("file:icon.png"));
As per the comment below, if it's wrapped in a containing jar you'll need to use the following approach instead:
stage.getIcons().add(new Image(<yourclassname>.class.getResourceAsStream("icon.png")));