Menu

[solved]-Think Gui Layout Put Together Somewhat Correctly Feel Free Change Completely Far Need Use Q39082852

Homework 8 Extra Credit Assignment updated.txt Load File Save File As text.txt Qualified freshman and transfer students who hPart II: Loading a File (6 points) Add event-handling code for the Load File button and its associated TextField so that thPart III: Saving a File (6 points) Add event-handling code for the Save File As button and its associated TextField so thatHomework 8 Extra Credit Assignment Save File As cAS!@#(&@ Load File texttxt Qualified freshman and transfer students who havePart IV: Change Text Area Contents to Lowercase (5 points) Add event-handling code to the To Lower button so that the conteor writing takes place as a result of pressing this buttonPart VIII: Display File Statistics (6 points) In the lower-left comer of the window create a Label that displays the number o

I think the GUI layout has been put together somewhat correctly,but feel free to change it completely. This is what I have so far.You do not need to use it! Thank you!

import javafx.application.Application;import javafx.geometry.Insets;import javafx.scene.Scene;import javafx.scene.control.*;import javafx.geometry.*;import javafx.scene.control.Button;import javafx.scene.control.Label;import javafx.scene.control.TextArea;import javafx.scene.control.TextField;import javafx.scene.layout.*;import javafx.stage.Stage;import java.io.*;public class Homework8 extends Application{ //Buttons Button btLoadFile = new Button(“Load File”); Button btSaveFileAs = new Button(“Save File As”); Button btToLower = new Button(“To Lower”); Button btToUpper = new Button(“To Upper”); Button btToTitleCase = new Button(“To TitleCase”); Button btReplaceAll = new Button(“Replace All”); //TextFields TextField tfLoadFile = new TextField(); TextField tfSaveFile = new TextField(); TextArea taText = new TextArea(); TextField tfFindWord = new TextField(); TextField tfReplaceWord = new TextField(); //Labels Label labWords = new Label(“#words:”); Label labChars = new Label(“#chars:”); Label labSeconds = new Label(“Seconds since last save:”); @Override public void start(Stage primaryStage){ //Create and set position of GridPane GridPane pane = new GridPane(); pane.setHgap(5); pane.setVgap(5); pane.setAlignment(Pos.CENTER); pane.setPadding(new Insets(20)); //Create and position all Labels and Buttons pane.add(btLoadFile, 0, 0); pane.add(tfLoadFile, 1, 0,2,1); pane.add(btSaveFileAs, 3, 0); pane.add(tfSaveFile, 4, 0); pane.add(taText, 0, 1, 6, 6); pane.add(btToLower,0,10); pane.add(btToUpper, 1, 10); pane.add(btToTitleCase, 2, 10); pane.add(new Label(“Find:”),0,11); pane.add(tfFindWord,1,11,2,1); pane.add(new Label(“Replace with:”),3, 11); pane.add(tfReplaceWord,4,11); pane.add(btReplaceAll,5,11); pane.add(labWords,0,12); pane.add(labChars, 1, 12); pane.add(labSeconds,3,12); //Events btLoadFile.setOnAction(e -> {} ); // Was thinking use the ValidateFile method I partly wrote // to check if it exists and then have displayed in the TextArea box. Scene scene = new Scene(pane); primaryStage.setScene(scene); primaryStage.setTitle(“Basic Text Editor”); primaryStage.show(); } public static void validateFile(File file){ if (!file.exists()){ Alert alert = new Alert(Alert.AlertType.ERROR); alert.setContentText(“File not found!”); alert.show(); } else{ //Display the text in the TextArea box. } }}Homework 8 Extra Credit Assignment updated.txt Load File Save File As text.txt Qualified freshman and transfer students who have indicated their interest in the major on their applications MUST be admitted directly as a degree major or as a pre-major. Pre-majors are placed into the Area of Interest (AOI) program and to be eligible for the degree, they must be admitted to and declare the major. The requirements and application process for matriculation are detailed below. Students admitted to other programs within the College of Engineering and Applied Science (CEAS) follow the same admissions process as students in the A0I program. Students in programs outside of CEAS (non-CEAS students) and double major applicants MUST apply for admission to the degree program following a separate process, outlined below. To Upper To Lower To Title Case Replace with Replace All Find MUST may Seconds since last save: 26 #words: 115 # chars: 736 Part I: GUI Layout (10 points) To get started, create the file Homework8.javaandcreate the class Homework8 to extend the Application class. Override the method Application.start to create and add all the GUI elements shown in the screen shot above. A suggestion: use a GridPane to lay out the GUI components. The large box in the middle is a TextArea. On the bottom of the screen there are two Label components: one showing the number of words and characters in the text area, and a second one that shows how many seconds have elapsed since the user last saved a file Y Part II: Loading a File (6 points) Add event-handling code for the “Load File” button and its associated TextField so that the user can load the file with the name provided in the text field and display its contents in the text area for editing. If you are using IntelliJ to implement this assignment, place your input text file in the top directory of your Intelli project (perhaps you called it “CSE 114”) Use an Alert Dialog to show an informative error message if a problem is encountered while reading the file. The only problem your are likely to encounter is that the user entered an invalid filename. A sample error dialog box is shown below Homework 8 Extra Credit Assignment Load File garbage Save File As Error X Error File not found. OK To Upper To Lower To Title Case Find Replace with: Replace All #words: TBD #chars : TBD Seconds since last save: 84 Part III: Saving a File (6 points) Add event-handling code for the “Save File As” button and its associated TextField so that the user can save the current contents of the text area into a file with the name provided in the text field. If you are using IntelliJ to implement this assignment, your output text file will be saved in the top directory of your Intelli project (perhaps you called it “CSE 114”) Use an Alert Dialog to show an informative error message if a problem is encountered while writing the file. The only problem your are likely to encounter is that the user entered an invalid filename. A sample error dialog box is shown below: Homework 8 Extra Credit Assignment Save File As cAS!@#(&@ Load File texttxt Qualified freshman and transfer students who have indicated their interest in the major on their applications may be admitted di Interest (AOI) progr The requirements a programs within th Error as students in the A major applicants m o the Area of declare the major. admitted to other admissions process nts) and double rocess, outlined Error X below. File could not be written . To Lower To Upper To Title Case Find Replace with Replace All # words : 115 # chars : 736 Seconds since last save: 30 OK Part IV: Change Text Area Contents to Lowercase (5 points) Add event-handling code to the “To Lower” button so that the contents of the text area are changed into lowercase Spaces, punctuation marks, digits and other non-letter characters should remain unchanged. No file reading or writing takes place as a result of pressing this button Part V: Change Text Area Contents to Uppercase (5 points) Add event-handling code to the “To Upper” button so that the contents of the text area are changed into uppercase Spaces, punctuation marks, digits and other non-letter characters should remain unchanged. No file reading or writing takes place as a result of pressing this button. Part VI: Change Text Area Contents to Title Case (5 points) Add event-handling code to the “To Upper” button so that the contents of the text area are changed into title case That is, given a word, change the leftmost character to uppercase (if that character is a letter) and all other letters in the word to lowercase. A “word” is defined as a group of characters that immediately follow one or more spaces. Also be sure to properly capitalize the first word in the text area, which is unlikely to have a space in front of it. Spaces, punctuation marks, digits and other non-letter characters should remain unchanged. No file reading or writing takes place as a result of pressing this button Part VII: Find and Replace Text (5 points) Add event-handling to the “Replace All” button so that the program searches through the text area for the text given in the “Find” text field and replaces it with the text given in the “Replace with” text field. If the “Find” text field is left blank then pressing this button should have no effect on the contents of the text area. No file reading or writing takes place as a result of pressing this button Part VIII: Display File Statistics (6 points) In the lower-left comer of the window create a Label that displays the number of words and characters in the text area. The definition of a “word” is given in Part VI. The contents of this label are updated with each key press inside the text area. You are not required to show the line over the label as shown in the screen shot above, but if you want to incorporate it you will need to learn a little about JavaFX CSS. Part IX: Seconds Elapsed Since Last Save (6 points) In the lower-right corner of the window create a Label that displays the number of seconds that have elapsed since the user successfully saved the contents of the text area into a text file. The easiest way to accomplish this is to use a Timeline object. Have your timer update the contents of the label every 1000 milliseconds (i.e., every 1 second). You are not required to show the line over the label as shown in the screen shot above, but if you want to incorporate it you will need to learn a little about JavaFX CSS. Show transcribed image text Homework 8 Extra Credit Assignment updated.txt Load File Save File As text.txt Qualified freshman and transfer students who have indicated their interest in the major on their applications MUST be admitted directly as a degree major or as a pre-major. Pre-majors are placed into the Area of Interest (AOI) program and to be eligible for the degree, they must be admitted to and declare the major. The requirements and application process for matriculation are detailed below. Students admitted to other programs within the College of Engineering and Applied Science (CEAS) follow the same admissions process as students in the A0I program. Students in programs outside of CEAS (non-CEAS students) and double major applicants MUST apply for admission to the degree program following a separate process, outlined below. To Upper To Lower To Title Case Replace with Replace All Find MUST may Seconds since last save: 26 #words: 115 # chars: 736 Part I: GUI Layout (10 points) To get started, create the file Homework8.javaandcreate the class Homework8 to extend the Application class. Override the method Application.start to create and add all the GUI elements shown in the screen shot above. A suggestion: use a GridPane to lay out the GUI components. The large box in the middle is a TextArea. On the bottom of the screen there are two Label components: one showing the number of words and characters in the text area, and a second one that shows how many seconds have elapsed since the user last saved a file Y
Part II: Loading a File (6 points) Add event-handling code for the “Load File” button and its associated TextField so that the user can load the file with the name provided in the text field and display its contents in the text area for editing. If you are using IntelliJ to implement this assignment, place your input text file in the top directory of your Intelli project (perhaps you called it “CSE 114”) Use an Alert Dialog to show an informative error message if a problem is encountered while reading the file. The only problem your are likely to encounter is that the user entered an invalid filename. A sample error dialog box is shown below Homework 8 Extra Credit Assignment Load File garbage Save File As Error X Error File not found. OK To Upper To Lower To Title Case Find Replace with: Replace All #words: TBD #chars : TBD Seconds since last save: 84
Part III: Saving a File (6 points) Add event-handling code for the “Save File As” button and its associated TextField so that the user can save the current contents of the text area into a file with the name provided in the text field. If you are using IntelliJ to implement this assignment, your output text file will be saved in the top directory of your Intelli project (perhaps you called it “CSE 114”) Use an Alert Dialog to show an informative error message if a problem is encountered while writing the file. The only problem your are likely to encounter is that the user entered an invalid filename. A sample error dialog box is shown below:
Homework 8 Extra Credit Assignment Save File As cAS!@#(&@ Load File texttxt Qualified freshman and transfer students who have indicated their interest in the major on their applications may be admitted di Interest (AOI) progr The requirements a programs within th Error as students in the A major applicants m o the Area of declare the major. admitted to other admissions process nts) and double rocess, outlined Error X below. File could not be written . To Lower To Upper To Title Case Find Replace with Replace All # words : 115 # chars : 736 Seconds since last save: 30 OK
Part IV: Change Text Area Contents to Lowercase (5 points) Add event-handling code to the “To Lower” button so that the contents of the text area are changed into lowercase Spaces, punctuation marks, digits and other non-letter characters should remain unchanged. No file reading or writing takes place as a result of pressing this button Part V: Change Text Area Contents to Uppercase (5 points) Add event-handling code to the “To Upper” button so that the contents of the text area are changed into uppercase Spaces, punctuation marks, digits and other non-letter characters should remain unchanged. No file reading or writing takes place as a result of pressing this button. Part VI: Change Text Area Contents to Title Case (5 points) Add event-handling code to the “To Upper” button so that the contents of the text area are changed into title case That is, given a word, change the leftmost character to uppercase (if that character is a letter) and all other letters in the word to lowercase. A “word” is defined as a group of characters that immediately follow one or more spaces. Also be sure to properly capitalize the first word in the text area, which is unlikely to have a space in front of it. Spaces, punctuation marks, digits and other non-letter characters should remain unchanged. No file reading or writing takes place as a result of pressing this button Part VII: Find and Replace Text (5 points) Add event-handling to the “Replace All” button so that the program searches through the text area for the text given in the “Find” text field and replaces it with the text given in the “Replace with” text field. If the “Find” text field is left blank then pressing this button should have no effect on the contents of the text area. No file reading
or writing takes place as a result of pressing this button
Part VIII: Display File Statistics (6 points) In the lower-left comer of the window create a Label that displays the number of words and characters in the text area. The definition of a “word” is given in Part VI. The contents of this label are updated with each key press inside the text area. You are not required to show the line over the label as shown in the screen shot above, but if you want to incorporate it you will need to learn a little about JavaFX CSS. Part IX: Seconds Elapsed Since Last Save (6 points) In the lower-right corner of the window create a Label that displays the number of seconds that have elapsed since the user successfully saved the contents of the text area into a text file. The easiest way to accomplish this is to use a Timeline object. Have your timer update the contents of the label every 1000 milliseconds (i.e., every 1 second). You are not required to show the line over the label as shown in the screen shot above, but if you want to incorporate it you will need to learn a little about JavaFX CSS.

Expert Answer


Answer to I think the GUI layout has been put together somewhat correctly, but feel free to change it completely. This is what I … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *