Home > Back-end >  Deployment headaches in the eclipse run successful but jump out of the window shows nothing
Deployment headaches in the eclipse run successful but jump out of the window shows nothing

Time:09-20



The code is as follows:

Package the application.
The import deployment headaches. Application. The application;
The import deployment headaches. Stage. Stage;
The import deployment headaches. The scene. The scene;
The import deployment headaches. Scene. Image. Image;
The import deployment headaches. Scene. Image. ImageView;
The import deployment headaches. Scene. Control. The Button;
The import deployment headaches. Scene. Layout. BorderPane;
The import deployment headaches. Scene. Layout. Pane;
The import deployment headaches. Geometry. Insets;

Public class MyWindow extends Application {
@ Override
Public void start (Stage primaryStage) {
BorderPane rootPane=new BorderPane ();//create boundary panel object
RootPane. SetPadding (new Insets (8,8,8,8));//Settings panel edge around the inside of the blank
Image imb=new Image ("./images/flag. JPG ");//create images using image url
ImageView iv=new ImageView (imb);//object using the specified image display image object creation
Iv. SetFitWidth (80);//set the image view width
Iv. SetPreserveRatio (true);//set the image scaling
Iv. SetSmooth (true);//set the use smooth image display image
Iv. SetCache (true);//set the buffer to improve performance
Pane Pane=new Pane ();//create a panel object
Pane. GetChildren (). The add (iv);//the images to the pane panel
The Button bt=new Button (" northern area ");
RootPane. SetTop (bt);
RootPane. SetBottom (new Button (" south "));
RootPane. SetLeft (new Button (" western regions "));
RootPane. SetRight (new Button (" display "));
RootPane. SetCenter (pane);
Scene Scene=new Scene (rootPane);
PrimaryStage. SetTitle (" layout ");
PrimaryStage. SetScene (scene);
PrimaryStage. The show ();
}
}
  • Related