subject

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.
8. Adjust the spacing, alignment, and style of the application

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 07:30, ghopk5929
In the film "epic 2015," epic is the name for:
Answers: 3
image
Computers and Technology, 22.06.2019 08:00, lindseyreneesmith7
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
image
Computers and Technology, 22.06.2019 12:10, drelisech6467
Linux is distributed under gnu gpl. why is this important? a. it ensures that only torvalds can profit from the sale of linux b. it prevents unknowledgeable users from downloading programs they don't know how to operate. c. it provides protection for the developers who created linux. d. it states that anyone can copy, modify, and share the program if changes are made public.
Answers: 1
image
Computers and Technology, 24.06.2019 21:30, keelynnbarrier
Computer security/cybersecurity1) each of the following code fragments contains a number of security vulnerabilities. for each fragment, identify these security vulnerabilities and, for each vulnerability, discuss at least one way that it could be improved. note that in your discussion of how each vulnerability could be improved, you do not need to re-write a new version of the program in c; simply discuss your solution, either in pseudocode or in 1-2 sentences. a) /* file descriptor leak */#include #include int main(int argc, char *argv[]){ char *filepath = argv[0]; char *shellpath = argv[1]; file *passwords; passwords = fopen(filepath, "r"); /* read the password and do something with it */ /* . . */ /* fork and execute alternative shell */ execl(shellpath, "shell", null); }b)#include /* assume the following function is written for an electronic storefront. the user will enter the id of the item to be ordered, as well as the quantity of units that they would like to purchase. the program will then lookup the price for the price for the item using a predefined function, and return the total cost of the order.*/int gettotalcost(){ char itemid[9]; int price, unitsordered, cost; printf(" enter the 9-digit id of the item to be ordered: "); scanf("%s", & itemid); /* lookup the price according to the itemid */ price = getpricebyid(itemid); printf(" enter the quantity of units to be ordered: "); scanf("%d", & unitsordered); cost = price * unitsordered; return cost; }c)#include /* the following function is intended to return a user's full name by concatenating the user's first and last name into a single string and then returning that string. */char *getfullname(char *firstname, char *lastname, int max_len){ char fullname[max_len]; strcpy(fullname, firstname); strcat(fullname, " "); strcat(fullname, lastname); return fullname; }d)#include /* the following code snippet runs through the list of cli arguments entered and displays them to the console. */int main(int argc, char *argv[]){ int i; printf("you've entered the following arguments: "); for(i = 0; i < argc; i++){ print(argv[i]); printf("\n"); } /* */}
Answers: 2
You know the right 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:

Konu
Mathematics, 01.10.2021 20:40
Konu
Mathematics, 01.10.2021 20:40
Konu
Mathematics, 01.10.2021 20:40
Konu
Mathematics, 01.10.2021 20:40