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 114 times)

cool

  • Hero Member
  • *****
  • Posts: 570

Question 1

To place two nodes node1 and node2 in a HBox p, use ________.
◦ p.add(node1, node2);
◦ p.getChildren().addAll(node1, node2);
◦ p.getChildren().add(node1, node2);
◦ p.addAll(node1, node2);

Question 2

Analyze the following code:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.HBox;
import javafx.scene.shape.Circle;

public class Test extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
HBox pane = new HBox(5);
Circle circle = new Circle(50, 200, 200);
pane.getChildren().addAll(circle);
circle.setCenterX(100);
circle.setCenterY(100);
circle.setRadius(50);
pane.getChildren().addAll(circle);
// Create a scene and place it in the stage
Scene scene = new Scene(pane);
primaryStage.setTitle("Test"); // 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 has a runtime error since the circle is added to a pane twice.
◦ The program runs fine and displays two circles.
◦ The program has a compile error since the circle is added to a pane twice.
◦ The program runs fine and displays one circle.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

Hdosisshsbshs

  • Sr. Member
  • ****
  • Posts: 315
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




cool

  • Member
  • Posts: 570
Reply 2 on: May 6, 2020
Wow, this really help


deja

  • Member
  • Posts: 332
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Many medications that are used to treat infertility are injected subcutaneously. This is easy to do using the anterior abdomen as the site of injection but avoiding the area directly around the belly button.

Did you know?

Less than one of every three adults with high LDL cholesterol has the condition under control. Only 48.1% with the condition are being treated for it.

Did you know?

The cure for trichomoniasis is easy as long as the patient does not drink alcoholic beverages for 24 hours. Just a single dose of medication is needed to rid the body of the disease. However, without proper precautions, an individual may contract the disease repeatedly. In fact, most people develop trichomoniasis again within three months of their last treatment.

Did you know?

Atropine, along with scopolamine and hyoscyamine, is found in the Datura stramonium plant, which gives hallucinogenic effects and is also known as locoweed.

Did you know?

There are more bacteria in your mouth than there are people in the world.

For a complete list of videos, visit our video library