Answered! Run Listing 14.9, p. 550 (in zipped NB project for Chapter 14). You'll need to download the image file us.gif and add…

3. Run Listing 14.9, p. 550 (in zipped NB project for Chapter 14). Youll need to download the image file us.gif and add it to your project OR usethe URL that you find in the code. Take a screenshot of the window and paste it into your document. Which method did you use to display the flag? Listing 14.9 displays an image in three image views, as shown in Figure 14.14. LISTING I4.9 ShowImage. java 1 import javafx application Application; 2 import javafx. scene. Scene 3 import javafx.scene. layout. HBox; 4 import javafx. scene.layout. Pane; 5 import javafx.geometry.Insets; 6 import javafx.stage.Stage 7 import javafx.scene. image. Image: 8 import javafx.scene.image.Imageview; 10 public class ShowImage extends Application 11 eoverride Override the start method in the Application class 12 public void start CStage primaryStage) 13 Create a pane to hold the image views 14 Pane pane new HBox(10) ute an HBox 15 pane. SetPadding(new Insets(55, 5, 5, 5)) 16 Image image new Image( image/us te an image an image view to pane 17 pane .getChildrenO.addCnew ImageviewCimage)); 18 19 Imageview i mageview2 new Imageview(image); te an image view mage view properties 20 imageview2.setFitHeight 100); 21 imageview2.setFitwidthC100); 22 pane .getChildren addCi mageview2) add an image to 23 24 ImageView imageview3 new ImageView(image) create an image imageView3.setRotate(90): 25 rotate an image 26 pane .getChildren (D.addCimageView3) add an image to 27 28 Create a scene and place it in the stage 29 Scene scene new Scene (pane) 30 primary Stage setTitle(ShowImage); Set the stage title 31 primary Stage setScene(scene) Place the scene in the stage 32 primary stage show() Display the stage 33 34 Show Image

Run Listing 14.9, p. 550 (in zipped NB project for Chapter 14). You’ll need to download the image file us.gif and add it to your project OR use the URL that you find in the code. Take a screenshot of the window and paste it into your document. Which method did you use to display the flag? import javafx.appli cati on.Appl1cation: import javafx.scene.Scene: import javafx.scene.layout.HBox: import javafx.scene.layout.Pane: import javafx.geometry.Insets: import javafx.stage.Stage: import javafx.scene.image.Image: import javafx.scene.image.ImageView: public class Show image extends Application { @Override//Override the start method in the Application class public void start(Stage primaryStage) { //Create a pane to hold the image views Pane pane = new HBox(10): ane.setPadding(new Insets(exist, 5, 5, 5)): Image image = new Image(image/us.gif”):pane.getChiIdren().add(new ImageVi ew(image)): ImageView imageView2 = new ImageView(image): imageVi ew2.set Fi tHei ght(100): imageVi ew2.setFitwi dth(100): pane.getChi1dren().add(i mageView2): ImageView imageView3 = new ImageView(image): imageVi ew3.setRotate(90): pane.getChi1dren().add(imageVi ew3)://Create a scene and place it in the stage Scene scene = new Scene(pane): primaryStage.setTitle(Showlmage”);//Set the stage title primaryStage.setScene(scene);//Place the scene in the stage primaryStage.show();//Display the stage } }

Expert Answer

 
Still stressed from student homework?
Get quality assistance from academic writers!