This topic contains a solution. Click here to go to the answer

Author Question: Analyze the following code:import javafx.application.Application;import javafx.scene.Scene;import ... (Read 69 times)

armygirl

  • Hero Member
  • *****
  • Posts: 556
Analyze the following code:

import javafx.application.Application;
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 Test 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);
pane.setPadding(new Insets(5, 5, 5, 5));
Image image = new Image("www.cs.armstrong.edu/liang/image/us.gif");
pane.getChildren().addAll(new ImageView(image), new ImageView(image));

// Create a scene and place it in the stage
Scene scene = new Scene(pane);
primaryStage.setTitle("ShowImage"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
 
/**
* The main method is only needed for the IDE with limited
* JavaFX support. Not needed for running from the command line.
*/
public static void main(String[] args) {
launch(args);
}
}

◦ The program runs fine and displays two images.
◦ The image object cannot be shared by two ImageViews.
◦ new Image("www.cs.armstrong.edu/liang/image/us.gif") must be replaced by new Image("http://www.cs.armstrong.edu/liang/image/us.gif").
◦ The addAll method needs to be replaced by the add method.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by armygirl on May 6, 2020

ky860224

  • Sr. Member
  • ****
  • Posts: 350
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 25% of students answer this correctly




armygirl

  • Member
  • Posts: 556
Reply 2 on: May 6, 2020
Thanks for the timely response, appreciate it


Sarahjh

  • Member
  • Posts: 370
Reply 3 on: Yesterday
Excellent

 

Did you know?

Serum cholesterol testing in adults is recommended every 1 to 5 years. People with diabetes and a family history of high cholesterol should be tested even more frequently.

Did you know?

The FDA recognizes 118 routes of administration.

Did you know?

According to animal studies, the typical American diet is damaging to the liver and may result in allergies, low energy, digestive problems, and a lack of ability to detoxify harmful substances.

Did you know?

For high blood pressure (hypertension), a new class of drug, called a vasopeptidase blocker (inhibitor), has been developed. It decreases blood pressure by simultaneously dilating the peripheral arteries and increasing the body's loss of salt.

Did you know?

The average older adult in the United States takes five prescription drugs per day. Half of these drugs contain a sedative. Alcohol should therefore be avoided by most senior citizens because of the dangerous interactions between alcohol and sedatives.

For a complete list of videos, visit our video library