Question: CST 2 4 2 Advanced Programming Using Java March 1 5 , 2 0 2 4 In publishing, advertising and related fields, the word copy
CST Advanced Programming Using Java March In publishing, advertising and related fields, the word copy refers to written material in books, magazines, newspapers and advertising. Create a JavaFX application as per the image below in the form of a Copy Editor application with Search and Update functionality. When the application runs, the user sees text in the window that may need editing. The window should contain one TextArea, two TextFields and two Buttons First create a TextArea with the text in the image above already displayed. This is the copy text to be edited. Use the setEditable method to set that property to false so the user cannot type in the TextArea and the setWrapText method to set that property to true so the text wraps from line to line. The two TextFields allow the user to type the search string and the update string place appropriate place Labels above these two TextFields The Buttons are the Search button and the Update button. Create event handlers that respond to these two buttons. If the user clicks the Search button, use string manipulation techniques to determine if the search substring is located within the copy string from the TextArea. If this is true, display the location the index of the search substring within the copy string in a showMessageDialog Otherwise display a Not Found error message. If the user instead clicks the Update button, use string manipulation to determine if the search substring is located within the copy string. If this is true, use the contents of the update string TextField to replace the found string within the TextArea. If the search string is not found within the TextArea, show a Not Found error message in a showMessageDialog Both buttons in this application begin by looking for the search substring within the TextArea and display an error message in a showMessageDialog if it is not present. In one way or another, implement this task in your application so that it is coded just once. For full credit, create and use for all the event processing above a programmeddefined class SearchAndUpdate with two String instance variables copyString and searchString. The single constructor takes two String parameters when instantiating the object, pass to the constructor the values from the copy TextArea and the search TextField and assigns them to the two instance variables by calling the set methods see below The additional class methods are: Set methods for the two instance variables in the set method for searchString create and use a programmerdefined exception class EmptyStringException that extends from the Java API class Exception to validate that the search TextField is not blank; catch this exception in the event handler or handlers Get methods for the two instance variables A method search of type int that performs the search processing and returns the index of the search substring within the copy string, or a default value if not found A method update of type String that performs the update processing and returns an updated String with the update string substituted in the copy string this method uses method search from above to validate that the search string is located within the copy string For partial credit you may eliminate any of the following: The programmerdefined class SearchAndUpdate point reduction The update functioningonly implement the search functioning point reduction The exception handling with the class EmptyStringException point reduction Or eliminate both the update and search functioning as well the programmerdefined class and the exception class, and only draw the JavaFX form point reduction
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
