I have two monitors. I have Eclipse open on the second monitor but when I run my JavaFX code, the JavaFX window always opens up in the first monitor and every time I have to
You can iterate Screen.getScreens() and move your stage to required one. See example below.
public class FXScreens extends Application {
@Override
public void start(Stage stage) {
VBox root = new VBox(10);
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 200, 250);
int index = 1;
for (Screen screen : Screen.getScreens()) {
Rectangle2D bounds = screen.getVisualBounds();
Button btn = new Button("Move me to Screen " + index++);
btn.setOnAction((e) -> {
stage.setX(bounds.getMinX() + 100);
stage.setY(bounds.getMinY() + 100);
});
root.getChildren().add(btn);
}
stage.setTitle("Screen Jumper");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Unfortunately I can't help with components not loading on primary screen. Please provide more details to address that (which components, how are they created, code sample, etc)