Complete in Java:
This program should have three screens;
1. Title Screen – This screen should have text across the top saying, “Welcome to the Button Clicking Game!” Underneath that, should be a text box that asks the user to input their name. Next to the text box, there should be a button that initiates the game, but only if a name has been typed into the text box.
2. The Game Screen – The game is simple. There is a button in the middle of the screen that reads, ‘Click Me’ However, when the mouse approaches the button, it runs away. The user should never be able to catch the button, and if they chase it to the side of the pane, it should jump back to the middle of the pane. To make this easier for escape, the pane should quite large, > 1000x1000. As soon as the game starts, there should be a 20-second timer started. This timer can be hidden, but at 5-second intervals, the button should mock the user with an insult. At the 20 second mark, the game ends, and should transition to the ‘Game Over’ screen.
3. Game Over – This screen should just be an Image.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Duration;

* @author
public class Test2 extends Application {

    private Node titleNode;
    private Node gameNode;
    private Node gameoverNode;

    private StackPane stack = new StackPane(); // to hold all scenes

    private int timeOut;

    public void start(Stage stage) throws FileNotFoundException {
       // put node into the stack pane
       ObservableList<Node> children = stack.getChildren();
       titleNode = titleScene();

       gameNode = gameScene();

       gameoverNode = gameOverScene();
       // create and configure the scene
       Scene scene = new Scene(stack, 1000, 1000);
       // configure the stage
       stage.setTitle("TEST #2");

By purchasing this solution you'll be able to access the following files: and Solution.png.

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats