Computers and Technology
Computers and Technology, 23.04.2021 16:10, reilly90

Purpose: The lab this week focuses on using some CSS to style an application as well as the Slider and TextArea controls and the FileChooser class. The application will use three Slider controls to change the color of the text in a TextArea control and the FileChooser class to open and save text files. Task: Create a project called ColorControlPanel_FirstName_LastNam e or Lab9_FirstName_LastName. Remember to include comments summarizing the program.
1. Make sure you have imported all of the classes necessary for this application. This program will require Application, Stage, Scene, Button, Label, Slider, FileChooser, TextArea, HBox, VBox, and may require Pos and Insets (depending on how you approach customizing the interface). In addition to these JavaFX imports, you will also need to import Scanner and all classes from the io package. Prepare the program to be executed as a JavaFX application.
2. In the global scope of the class, declare a String variable that will hold the current file path. Initialize this String to "untitled". Make sure both the main and start methods include a throws clause to handle an IOException.
3. For the interface of this application, you will need two Button controls: Open and Save. Additionally, you will need three Slider controls for the red, green, and blue. Lastly, you will need a TextArea control. The title of the application will reflect the file that is currently open. Use the file path String to set the title. Refer to the example near the end of the directions.
4. When the Open button is clicked, the open dialog method of the FileChooser class is called. After a file is selected to open, use the getPath method to get the file path and assign that to the String for the file path. Update the title of the application to indicate the current file path. Update the TextArea to contain the text from the file.
5. When the Save button is clicked, check to see if the file path currently held by the String exists. a. If this file path does exist, write the contents of the TextArea to the file. b. If the file path does not exist, call the save dialog method of the FileChooser class. After a location is selected and a file name is given, use the getPath method to get the file path and assign that to the String for the file path. Update the title of the application to indicate the current file path. Write the contents of the TextArea to the file.
6. Each of the three Slider controls must have a Label indicating the color each affects. The Slider and Label pairs are each placed in an HBox. The three colors are red, green, and blue. The min and max values for the Sliders are 0 and 255, respectively. The initial value is 0. The tick marks are visible. The major ticket unit is 15. The minor tick count is 5. The labels are visible. The slider knob snaps to the closest tick mark. The width of each slider is 512.
7. Add an event listener to each Slider control as a lambda expression. a. Assign the value of each of the three Sliders to three double variables. b. Using inline styling, set the style for the TextArea to change the color of the text. The property-related to text color is -fx-text-fill. You can use the RGB format for setting the color since each Slider holds a decimal value for that color. Keep in mind the following format: -fx-text-fill: RGB(red, green, blue); The red, green, and blue should be replaced with the variables that hold the values of each of the three Sliders. Make sure the Label and Slider are consistent; if you indicate a Slider is for green, that Slider should affect the amount of green in text.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 07:30, DivineMemes420
What type of computer network ensures high security ?
Answers: 1
image
Computers and Technology, 22.06.2019 17:00, hollodom9654
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
image
Computers and Technology, 23.06.2019 06:40, euniceyi56
How many nibbles can be stored in a 16-bit word?
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, gabby640
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
Answers: 1
Do you know the correct answer?
Purpose: The lab this week focuses on using some CSS to style an application as well as the Slider a...

Questions in other subjects: