Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, rodfam13716
If you turn on the lock alpha button , what happens
Answers: 1
image
Computers and Technology, 22.06.2019 15:10, reycaden
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
image
Computers and Technology, 22.06.2019 20:10, yqui8767
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, taytay1828
What are the 12 colors of the spectrum called?
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: