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 115 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
:D TYSM


peter

  • Member
  • Posts: 330
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

Acetaminophen (Tylenol) in overdose can seriously damage the liver. It should never be taken by people who use alcohol heavily; it can result in severe liver damage and even a condition requiring a liver transplant.

Did you know?

Medication errors are more common among seriously ill patients than with those with minor conditions.

Did you know?

Fungal nail infections account for up to 30% of all skin infections. They affect 5% of the general population—mostly people over the age of 70.

Did you know?

Hippocrates noted that blood separates into four differently colored liquids when removed from the body and examined: a pure red liquid mixed with white liquid material with a yellow-colored froth at the top and a black substance that settles underneath; he named these the four humors (for blood, phlegm, yellow bile, and black bile).

Did you know?

Drying your hands with a paper towel will reduce the bacterial count on your hands by 45–60%.

For a complete list of videos, visit our video library