Question

JavaFX! Just need to fill several lanes of code please!!!

CSE205 OOP and Data Structure Quiz #15 Last Name (print) First Name (print) Write a JavaFX GUI application program that simul

CSE205 00P and Data Structure Quiz #15 First Name (print) Last Name (print): //Create a KeyFrame object that increase the tim

CSE205 OOP and Data Structure Quiz #15 Last Name (print) First Name (print) Write a JavaFX GUI application program that simulates a timer. The timer should show "count: the beginning and increase the number by 1 in every one second, and so on. o" at .3 A Timer - × A Timer Count: 0 Count: 1 (B) After 1 second, the GUI Window (A) Initial GUI Window According to the description, finish the following program import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.control.Label; import javafx.scene.text.Font: import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.util.Duration; import javafx.event.ActionEvent; import javafx.event.EventHandler public class TimerQuiz extends Application private Label label; private int number; private Timeline timer; public void start (Stage primaryStage) number = 0; //initialize the label Label.setFont (new Font ("Arial", 30)): StackPane rootPane new StackPane(): //add the label inside the root Pane
CSE205 00P and Data Structure Quiz #15 First Name (print) Last Name (print): //Create a KeyFrame object that increase the timer every 1 second KeyFrame kf- //create a Timeline object called 、tiner, from above KeyFrame object //Set timer's cycle count to indefinite //start the timer // Create a scene and place the root Pane in the stage scene scene = new scene (rootPane , 220, 100); primaryStage.setTitle("A Timer"):/ Set the stage title primaryStage.setScene (scene): / Place the scee in the stage primarystage.show);7/ Display the stage //Handler class private class TimerHandler implements public void handle (ActionEvent event) //need to increase the number by 1 //change the label's text //The main method is only needed for the IDE with limited JavaFX support public static void main(String[] args) launch (args): //end of TimerQuiz class
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The Bold Lines are the answers for fill in the blanks

Code :

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package counter;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.util.Duration;

/**
*
* @author rohit
*/
public class TimerQuiz extends Application {
  
private Label label;
private int number;
private Timeline timer;
public void start(Stage primaryStage) {
number=0;
label = new Label();
label.setText("Count: "+number);

label.setFont(new Font("Arial",30));
StackPane root = new StackPane();
root.getChildren().add(label);
  
  
KeyFrame kf= new KeyFrame (Duration.seconds(1),new TimerHandler());
timer = new Timeline();
timer.getKeyFrames().add(kf);
timer.setCycleCount(timer.INDEFINITE);
timer.playFromStart();

  
Scene scene = new Scene(root, 220, 100);
primaryStage.setTitle("A Timer");
primaryStage.setScene(scene);
primaryStage.show();
}
  
private class TimerHandler implements EventHandler{
public void handle (Event e){
number+=1;
label.setText("Count: "+number);
}


}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
  
}

OUTPUT :

A Timer- Count: 0

A Timer- Count: 16

Alimer- Count: 27

Add a comment
Know the answer?
Add Answer to:
JavaFX! Just need to fill several lanes of code please!!! CSE205 OOP and Data Structure Quiz #15 Last Name (print) First Name (print) Write a JavaFX GUI application program that simulates a timer. T...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For this question you will need to complete the methods to create a JavaFX GUI application...

    For this question you will need to complete the methods to create a JavaFX GUI application that implements two String analysis algorithms. Each algorithm is activated when its associated button is pressed. They both take their input from the text typed by the user in a TextField and they both display their output via a Text component at the bottom of the GUI, which is initialized to “Choose a string methods as indicated in the partially completed class shown after...

  • Modify the JavaFX TipCalculator application program to allow the user to enter the number of persons...

    Modify the JavaFX TipCalculator application program to allow the user to enter the number of persons in the party through a text field. Calculate and display the amount owed by each person in the party if the bill is to be split evenly among the party members. /////////// TipCalculatorController.java: import java.math.BigDecimal; import java.math.RoundingMode; import java.text.NumberFormat; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.control.TextField; public class TipCalculatorController { // formatters for currency and percentages private...

  • I need to make javafx GUI application called Email that implements a prototype user interface for...

    I need to make javafx GUI application called Email that implements a prototype user interface for composing email message. The application should have labelled text fields for To, cc,bcc ,subject line, one for message body and button lebelled Send. When we click Send button, the program should print contents of all fields to standard output using println() statement. I am attaching photos of Email.java and EmailPane.java, I need to make it as per these classes CylinderSta.. Cylinder java MultiCylind.. ....

  • ***Please keep given code intact*** Write a JavaFX application that displays a label and a Button...

    ***Please keep given code intact*** Write a JavaFX application that displays a label and a Button to a frame in the FXBookQuote2 program. When the user clicks the button, display the title of the book that contains the opening sentence or two from your favorite book in the label. FXBookQuote2.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the...

  • Answer questions 1-20 about creating GUI applications with JavaFX 1. A tree-like data structure that contains...

    Answer questions 1-20 about creating GUI applications with JavaFX 1. A tree-like data structure that contains the components of a JavaFX GUI is called a: a. directory tree b. node tree c.node graph d. scene graph 2. A node in a scene graph that contains other nodes is called a: a. root node b. branch node c. leaf node d. terminal node 3. A node in a scene graph that has no children is called a: a. root node b....

  • Use Kilometer Converter application code to write Temperature Converter application to convert degrees Fahrenheit into degrees...

    Use Kilometer Converter application code to write Temperature Converter application to convert degrees Fahrenheit into degrees Celsius ((F - 32)*5/9). It needs to be JavaFX 1 import javafx.application. Application; 2 import javafx.stage. Stage; 3 import javafx.scene. Scene; 4 import javafx.scene.layout.HBox; 5 import javafx.scene.layout. VBox; 6 import javafx.geometry.Pos; 7 import javafx.geometry.Insets; 8 import javafx.scene.control.Label; 9 import javafx.scene.control. TextField; 10 import javafx.scene.control.Button; 11 import javafx.event. EventHandler; 12 import javafx.event. ActionEvent; 13 14 ** 15 * Kilometer Converter application 16 17 18 public...

  • You may adjust the code as you want. Thank you! CODING HERE: import javafx.application.Application; import javafx.event.*;...

    You may adjust the code as you want. Thank you! CODING HERE: import javafx.application.Application; import javafx.event.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.*; import javafx.geometry.*; public class OrderSystem extends Application implements EventHandler<ActionEvent> { // Attributes for GUI private Stage stage; // The entire window, including title bar and borders private Scene scene; // Interior of window private BorderPane layout; // Add four labels private Label itemLabel = new Label("Item Name:"); private Label numberLabel = new Label("Number:"); private Label costLabel...

  • JavaFX program - Add a second level to the game. //Main game object/class package main; import java.util.ArrayList; impo...

    JavaFX program - Add a second level to the game. //Main game object/class package main; import java.util.ArrayList; import javafx.animation.AnimationTimer; import javafx.beans.binding.Bindings; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class Game extends Pane implements Runnable {       // instance variables    private ArrayList<MOB> mobs;    private ArrayList<Rectangle> hitBoxes;    private ArrayList<Treasure> treasure;    private Player player;    private final ImageView background = new ImageView();    private Level level;    private SimpleIntegerProperty score;    private...

  • please help me debug this Create a Future Value Calculator that displays error messages in labels.GUISpecificationsStart...

    please help me debug this Create a Future Value Calculator that displays error messages in labels.GUISpecificationsStart with the JavaFX version of the Future Value application presented in chapter 17. Create error message labels for each text field that accepts user input. Use the Validation class from chapter 17 to validate user input.Format the application so that the controls don’t change position when error messages are displayed. package murach.business; public class Calculation {        public static final int MONTHS_IN_YEAR =...

  • JAVAFX ONLY PROGRAM!!!!! SORTING WITH NESTED CLASSES AND LAMBDA EXPRESSIONS. DIRECTIONS ARE BELOW: DIRECTIONS: The main...

    JAVAFX ONLY PROGRAM!!!!! SORTING WITH NESTED CLASSES AND LAMBDA EXPRESSIONS. DIRECTIONS ARE BELOW: DIRECTIONS: The main point of the exercise is to demonstrate your ability to use various types of nested classes. Of course, sorting is important as well, but you don’t really need to do much more than create the class that does the comparison. In general, I like giving you some latitude in how you design and implement your projects. However, for this assignment, each piece is very...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT