Reputation: 125
I have started writing an app using JavaFX (the open one) for GUI. I'm having this issue which is really annoying me. When I compile my app the window would appear in the background.
What I want is that when I compile my app and it would show I would have focus on that new window.
My OS is openSUSE Leap 15.1, Plasma desktop.
And here's my Main code in case it could matters:
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("forms/login/FrmLogin.fxml"));
Scene mainScene = new Scene(root);
primaryStage.setTitle("Login");
primaryStage.setScene(mainScene);
primaryStage.show();
primaryStage.setMinWidth(primaryStage.getWidth());
primaryStage.setMinHeight(primaryStage.getHeight());
primaryStage.setMaxWidth(primaryStage.getWidth());
primaryStage.setMaxHeight(primaryStage.getHeight());
primaryStage.toFront();
}
}
Upvotes: 1
Views: 84
Reputation: 125
As described in comments to original post:
I tested my project on Windows and then on previous version of openSUSE and it worked as expected. Aside of OS version the other difference was that I used "portable" version of Intellij IDEA instead of flatpak one and turned out that the flatpak is the issue, perhaps it doesn't have necessary privilages to focus new window
Upvotes: 1