facing Difficulties to create multiple scenes in a single stage.
this is the init method where i've loaded two images.
public void init() {
Rotate rotate=new Rotate();
rotate.setAngle(0.0);
rotate.setPivotX(1000/2);
rotate.setPivotY(1020/2);
Image img=new Image("file:///C:/Users/Avi/Desktop/test.jpg");
ImageView view=new ImageView(img);
Image back=new Image("file:///C:/Users/Avi/Desktop/background.jpg");
ImageView backview=new ImageView(back);
view.setOpacity(0.25);
view.setX(1000/2);
view.setY(1020/2);
sp_mainlayout = new StackPane();
backlay=new StackPane();
cc_custom = new CustomControl();
sp_mainlayout.getChildren().add(backview);
sp_mainlayout.getChildren().add(view);
sp_mainlayout.getChildren().add(cc_custom);
backlay.getChildren().add(backview);
}
Now in the start method the stage is single but i want to show one image at the background at a large size and the other one in front of it in a smaller size. But two scenes aren't working together. Need some modification for the code.(the sizes of the scenes will be different)
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Chess game");
Scene scene1 =new Scene(sp_mainlayout,800,600);
primaryStage.setScene(scene1);
primaryStage.show();
Scene scene =new Scene(backlay,800,600);
primaryStage.setScene(scene);
primaryStage.setMinWidth(300);
primaryStage.setMinHeight(300);
primaryStage.setResizable(false);
primaryStage.show();
}