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 134 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


lcapri7

  • Member
  • Posts: 350
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

The most common treatment options for addiction include psychotherapy, support groups, and individual counseling.

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?

A strange skin disease referred to as Morgellons has occurred in the southern United States and in California. Symptoms include slowly healing sores, joint pain, persistent fatigue, and a sensation of things crawling through the skin. Another symptom is strange-looking, threadlike extrusions coming out of the skin.

Did you know?

Amphetamine poisoning can cause intravascular coagulation, circulatory collapse, rhabdomyolysis, ischemic colitis, acute psychosis, hyperthermia, respiratory distress syndrome, and pericarditis.

Did you know?

In the United States, there is a birth every 8 seconds, according to the U.S. Census Bureau's Population Clock.

For a complete list of videos, visit our video library