Question
// Create a code that should like like this in Java. Image Discovered By Discovery Date Orbit Period Length of Day Named After Ceres.png Giuseppe
// Create a code that should like like this in Java.
Image | Discovered By | Discovery Date | Orbit Period | Length of Day | Named After |
Ceres.png | Giuseppe Piazzi | January 1, 1801 | 4.60 Earth Years | 9.07 Hours | The Roman Goddess of corn and harvests |
Eris.png | Brown, Trujillo, and Rabinowitz | October 21, 2003 | 561.37 Earth Years | 25.90 Hours | The ancient Greek goddess of discord and strife |
Haumea.png | Sierra Nevada Observatory | March 7, 2003 | 281.93 Earth Years | 3.91 hours | The Hawaiian goddess of childbirth and fertility |
Makemake.png | Brown, Trujillo, and Rabinowitz | March 31, 2005 | 305.34 Earth years | 22.48 hours | The Rapanui god of fertility |
Pluto.png | Clyde Tombaugh | February, 18 1930 | 247.92 Earth years | 153.29 hours | The ancient Greek god of the underworld |
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
This is the main application class for the
Dwarf Planets JavaFX application. */
public class DwarfPlanets extends Application
{
public void start(Stage stage) throws Exception
{
// EDIT THE LINES FOR TASK #2 HERE // Load the DwarfPlanets.fxml file. Parent parent = FXMLLoader.load( getClass().getResource("FILENAME.fxml"));
// Build the scene graph.
Scene scene = new Scene(parent);
// EDIT THE LINES FOR TASK #2 HERE // Set the title to display "Dwarf Planets".
// Display our window, using the scene graph.
stage.setTitle("TITLE"); stage.setScene(scene); stage.show();
}
public static void main(String[] args)
{
// Launch the application.
launch(args);
}
}
Code Listing 15.2 (DwarfPlanetsController.java)
import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.ToggleGroup;
// ADD LINES FOR TASK #3 HERE // Import the JavaFX Image class. import javafx.scene.image.ImageView;
/**
This is the controller class for the
Dwarf Planets JavaFX application.
*/
public class DwarfPlanetsController
{ @FXML
private ImageView dwarfPlanetsImageView;
@FXML
private Label discoveredByLabel;
@FXML
private Label dateOfDiscoveryLabel;
@FXML
private Label orbitPeriodLabel;
@FXML
private Label lengthOfDayLabel;
@FXML
private Label namedAfterLabel;
@FXML
private ToggleGroup dwarfPlanetsToggleGroup;
@FXML
private RadioButton ceresRadioButton;
@FXML
private RadioButton erisRadioButton;
@FXML
private RadioButton haumeaRadioButton;
@FXML
private RadioButton makemakeRadioButton;
@FXML
private RadioButton plutoRadioButton;
// ADD LINES FOR TASK #3 HERE
// Declare private fields for the images
// Load the image files in the intialize method
// Event listener for the ceresRadioButton public void ceresRadioButtonListener()
{
// ADD THE LINES FOR TASK #3 HERE
// If this radio button is selected, // display image and data for Ceres.
}
// Event listener for the erisRadioButton public void erisRadioButtonListener()
{
// ADD THE LINES FOR TASK #3 HERE
// If this radio button is selected,
// display image and data for Eris.
}
// Event listener for the haumeaRadioButton public void haumeaRadioButtonListener()
{
// ADD THE LINES FOR TASK #3 HERE // If this radio button is selected, // display image and data for Haumea.
}
// Event listener for the makemakeRadioButton public void makemakeRadioButtonListener()
{
// ADD THE LINES FOR TASK #3 HERE // If this radio button is selected, // display image and data for Makemake.
}
// Event listener for the plutoRadioButton public void plutoRadioButtonListener()
{
// ADD THE LINES FOR TASK #3 HERE
// If this radio button is selected, // display image and data for Pluto.
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started