Question: I need help with the following First Program: Unit07_Prog01 Write a program whose source file is named Unit07_Prog01.java that creates a Stage with the title
I need help with the following
First Program: Unit07_Prog01
Write a program whose source file is named Unit07_Prog01.java that creates a Stage with the title "Hello JavaFX!". Within the Stage a create a Scene that is 300 x 250 in size. And within that Scene create a single Button. The Button will have the title "Say 'Hello JavaFX'" as shown in the figure below (ignore the window decorations, they are platform specific, in this case Windows 10). You may want to use a Pane, such as a StackPane for example, to get the Button to center correctly (How would you do that?)
Once you have the GUI displaying properly, add the code to enable the Button to handle the ActionEvent that occurs when the button is clicked. Code your ActionEvent Handler so that the String "Hello JavaFX" is printed out on standard out (System.out). Clicking the x button on the top will stop the program (you get that behavior for free).
Second Program: Unit07_Prog02
Write a program whose source file is named Unit07_Prog02.java that creates a Stage with the title "Three Button Demo". Within the Stage a create a Scene that is 310 x 60 in size. Within that Scene you will put an HBox. In that HBox you place three buttons. The button labels will read: Button 01, Button 02, Button 03. The buttons should have a preferred size of 100x20. The user interface should look like this (ignore the window decorations, they are platform specific, in this case Ubuntu 16.04):
Once you have the GUI displaying properly, create an ActionEvent handler for each button that will print out on standard out (System.out) the following text: Button n pressed!, where n is the number of the button (01, 02, or 03). The user should be able to press buttons and see the print-out on standard out to her hearts content. Clicking the x button on the top will stop the program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
