logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

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

expert
Tristan WallaceEnglish
(5/5)

642 Answers

Hire Me
expert
Alvin BobadillaFinance
(5/5)

999 Answers

Hire Me
expert
Oriane BuraniManagement
(5/5)

964 Answers

Hire Me
expert
Dillon RamosResume writing
(5/5)

683 Answers

Hire Me
Java Programming

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.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. 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

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme