Suppose I have a class that extends the Application
class, as so. (This is an example of a Web Browser implementation I have found from another post)
public class WebViewBrowser extends Application {
@Override
public void start(Stage stage) throws Exception {
stage.setScene(new Scene(new WebViewPane("http://google.com")));
stage.setFullScreen(true);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
class WebViewPane extends Pane {
final WebView view = new WebView();
final Button goButton = createGoButton(view.getEngine());
public WebViewPane(String initURL) {
view.getEngine().load(initURL);
getChildren().addAll(view, goButton);
initLayout();
}
private Button createGoButton(final WebEngine eng) {
Button go = new Button("Refresh");
go.setDefaultButton(true);
go.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
eng.reload();
}
});
return go;
}
private void initLayout() {
setMinSize(500, 400);
setPrefSize(1024, 768);
view.prefWidthProperty().bind(widthProperty());
view.prefHeightProperty().bind(heightProperty());
goButton.setLayoutX(10);
goButton.layoutYProperty().bind(heightProperty().subtract(20).subtract(goButton.heightProperty()));
}
}
The issue I want to fix is that the JavaFX Application has an icon that is shown in the System Tray when running. I am going to use this Application to overlay on top of another program that is running. Thus it would look unprofessional if the icon in the System Tray is showing. I have seen this Stack Overflow post here, but I want to generally avoid adding Swing to my program because it will be messy trying to make both of these GUI API's to match with each other. I heard from an answer in the post that it would be possible in JavaFX 8 and up. Does anyone know a way to hide this JavaFX Application from showing in the System Tray only using JavaFX and not using Swing? Thanks.