logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write a Java program that constructs a Graphical User Interface using JavaFX.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Minimal Submitted Files

You are required, but not limited, to turn in the following source file:

Assignment12.java (no need to change)
ControlPane.java (no need to change)
TextControlPane.java (It needs to be completed)
TextPane.java (it needs to be created and completed)

Requirements to get full credits in Documentation

  1. The assignment number, your name, StudentID, Lecture day/time, and a class description need to be included at the top of each file/class.
  2. A description of each method is also needed.
  3. Some additional comments inside of methods (especially for a "main" method) to explain code that are hard to follow should be written.

New Skills to be Applied

In addition to what has been covered in previous assignments, the use of the following items, discussed in class, will probably be needed:

JavaFX

Classes may be needed:  
Button Event handling
Slider Event handling
Timeline animation

Program Description

Class Diagram:

Write a Java program that constructs a Graphical User Interface using JavaFX.

The  GUI program should contain two sets of four buttons for a text, "Start", "Stop", "Clear" and "Change the text". The first three buttons will be organized horizontally, and there should be a textfield where a user can enter a text, and the button “Change the text” should be  under the textfield (see the snapshot of the GUI). Under the button “Change the text”, there should be a label "Rate", then below it, there will be a slider that a user can use to change the rate (speed) of a text. Right hand side of the buttons, a textfield, a label and a slider there are panes, each pane showing a text with their initial color. The top should be red and the bottom one should be blue with their background black. The picture below shows a snap shot of the GUI. Each pane should keep printing the given text.

 (The size of the applet here is approximately 550 X 400).

When "Stop" button is pushed, the corresponding text printing movement stops. When "Start" button is pushed, the text printing movement should start printing again.

 

A user should be able to change the color of the text of each pane (top or bottom) using the Color Picker.

By entering another text in each textfield and pushing the button for "Change the text", will make the panel to start printing the newly entered text in their corresponding pane.

By moving each slider, a user should be able to change the rate of text printing. When a rate increases, the corresponding text printing is done faster. Note that these two sets of text printings can have a completely independent movement of each other.

Pushing the "Clear" button should clear all texts printed in the corresponding pane.
In the following snapshot, the clear button for the top pane was pushed, thus only the top pane was cleared.

 

Here is how it should work:

Play media comment.

Class description

TextPane class

TextPane class a subclass of Pane class. It is used to define a pane where texts are drawn. It has the following additional attributes:

Attribute name

Attribute type

Description

x1

double

current x coordinate of the text/string to be drawn

y1

double

current y coordinate of the text/string to be drawn

stepX

double

each step that the current x coordinate moves for the text/string for each timeline ticks

stepY

double

each step that the current x coordinate moves for the text/string for each timeline ticks

string1

String

current string to be drawn in a pane

currentColor

Color

color that is used to draw the string

timeline

Timeline

a given string will be drawn with this time line ticking

The following constructor method should be provided:

public TextPane(Color color, String initialString)

The current color is initialized to the value of the color parameter, and the string1 is initialized to the value of the initialString parameter.
The background of this pane should be set to black color. The x1 and y1 should be initialized to 0, and The stepX and stepY should be set to 30. The timeline1 should be instantiated with its duration of 1000 mill seconds and an object of TextHandler class that you will be defining. The timeline1’s rate should be 1.  Then it should start by calling play() method.

The following method should be implemented:

public void resume()

The timeline1 should start again using its start method.

public void suspend()

The timeline1 should stop using its stop method.

public void changeColor(Color anotherColor)

It sets the member variable currentColor using the parameter.

public void clear()

It should remove all text drawn in its pane.

public void changeString(String string2)

It sets the member variable string1 using the parameter.

public void setRate(int rate1)

This method set the rate of the timeline1 using its parameter. (Hint: setRate method of the Timeline class)

TextHandler class

This class can be defined as a private class of the TextPane. It implements ActionHandler interface.

public void handle(ActionEvent event)

Its handle method defines how texts are drawn in the pane. stepX should be added to x1 and stepY should be added to y1, then a new object of the Text class (javafx.scene.text package) should be created using the updated x1, y1, currentColor, and string1, and it should be added to the pane that is displaying them.
Also the drawn texts should not go outside of the panel. If x1+stepX < 0 or x1+stepX > getWidth()-string1.length()*7,
then the sign (+ or -) of stepX should be changed.
If x1+stepY < 0 or y1+stepY > getHeight(),
then the sign (+ or -) of stepY should be changed.

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

511 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

630 Answers

Hire Me
expert
Husnain SaeedComputer science

925 Answers

Hire Me
expert
Atharva PatilComputer science

925 Answers

Hire Me