Course Project DeVry University College of Engineering and Information Sciences Course Number: CIS355A Module 2: Start Your GUI Application Objectives · Take a UML Class diagram to code. · Create a...

1 answer below »
I need someone who knows Java. Java is a must in order to finish this project.


Course Project DeVry University College of Engineering and Information Sciences Course Number: CIS355A Module 2: Start Your GUI Application Objectives · Take a UML Class diagram to code. · Create a GUI application with labels, textfields, and buttons. · Use a layout manager to place components on the GUI. · Add events to the command buttons. Once we have designed our application, we need to take the design to code and create the application. The process will follow a very systematic approach because you have finished the hard work—the design. As you look at your design, implement the components and make the application work the way that you envisioned. First, create the GUI structure. Notice that the GUI class inherits from JFrame. As a result, we automatically get the close, minimize, and maximize buttons at the top, right corner, the title bar, and the basic application frame. We also automatically get the events for the close, minimize, maximize buttons. When you press the close button (red X at the top, right corner), the application will exit. Next, we will add the components. In the NetBeans environment, the components can be added to the GUI using the drag and drop interface. You are going to love it. However, once we have built the GUI, the application will not respond to your clicks. What are you going to do? You need to complete the final step. Add events to your buttons and other controls. Once you add the actionPerformed event to your buttons and the appropriate code, your application will respond and complete the task that you want to do. Software development is fun. Let’s get started. Steps 1. Create a new NetBeans project and save it in your CIS355A folder. Call the project “CIS355A - LASTNAME Landscaping”. Save all your CIS355A files in this folder. Make sure you create a GUI application. The main method can be in a separate launching class or, more typically, you can have the main method in the main JFrame class. If you do not create any classes when you create your NetBeans application, NetBeans will create the main method for you in your first JFrame GUI class. Remember to turn off the checkmark for create main class. 2. Open Visio class diagram that you created during the design phase. Take the Customer class diagram to code. As a reminder, here is the Customer class diagram from the design phase. Remember to code your constructors and get and set methods. 3. The toString( ) behavior should look like the following. @Override public String toString( ) { return name; // only show the Customer’s name } 4. The getDetails( ) behavior should look like this. public String getDetails( ) { DecimalFormat fmt = new DecimalFormat( "$#,##0.00" ); String output = name + "\n"; output += address + "\n"; output += "Type: " + yardType + "\n"; output += "Width: " + width + "\n"; output += "Length: " + length + "\n"; output += "Total Cost: " + fmt.format(totalCost); //currency return output; } 5. Look at the SECOND page (Page-2) of your Visio wireframe diagram. To keep the process simple this week, we are only going to create the labels, textfields, and buttons from the SECOND panel (Page-2) on your wireframe diagram (not including the panel itself). Use the drag and drop interface on NetBeans to create this GUI. Note: a multiline textbox is called a JTextArea in Java. Look for the text area component in the swing controls on the right side of NetBeans. 6. When you click on the calculate or the submit order buttons, nothing happens. We need to add events to these buttons. Right-click on the calculate button and choose Events Action actionPerformed. When you click on actionPerformed, NetBeans will create the actionPerformed event and method. NetBeans may take you to the method or, more likely, it will take you to the bottom of the code window. Scroll up and find the method for the event. If you called the button btnCalculate, then the event method will be called btnCalculateActionPerformed. Go inside the event method and add this code. // validate the inputs if (validateInputs( ) == false ) return; // end the method if validation failed // create the Customer object and show the information Customer cust = createCustomer( ); txaOrderInfo.setText( cust.getDetails( ) ); 7. The code above requires two methods: validateInputs( ) and createCustomer( ). The first method checks the inputs and makes certain that they contain good values. The second method gets the values from the textfields and creates a customer object with these values. Add the validateInputs( ) method to the very bottom of your code window. Notice that the validateInputs( ) method checks for empty fields and then uses try-catch error handling to validate numeric inputs. private boolean validateInputs() { String sName = txtName.getText(); String sAddress = txtAddress.getText(); String sWidth = txtWidth.getText(); String sLength = txtLength.getText(); if (sName.equals("")) { JOptionPane.showMessageDialog(this, "Enter a Name", "Name Error", JOptionPane.ERROR_MESSAGE); txtName.requestFocusInWindow(); return false; } if (sAddress.equals("")) { JOptionPane.showMessageDialog(this, "Enter a Address", "Address Error", JOptionPane.ERROR_MESSAGE); txtAddress.requestFocusInWindow(); return false; } if (sAddress.length() <= 5)="" {="" joptionpane.showmessagedialog(this,="" "address="" isn't="" long="" enough.",="" "address="" error",="" joptionpane.error_message);="" txtaddress.requestfocusinwindow();="" return="" false;="" }="" if="" (swidth.equals(""))="" {="" joptionpane.showmessagedialog(this,="" "enter="" a="" width",="" "width="" error",="" joptionpane.error_message);="" txtwidth.requestfocusinwindow();="" return="" false;="" }="" try="" {="" double.parsedouble(swidth);="" }="" catch="" (numberformatexception="" e)="" {="" joptionpane.showmessagedialog(this,="" "width="" must="" be="" a="" number",="" "width="" error",="" joptionpane.error_message);="" txtwidth.settext("");="" txtwidth.requestfocusinwindow();="" return="" false;="" }="" if="" (double.parsedouble(swidth)=""><= 0)="" {="" joptionpane.showmessagedialog(this,="" "width="" must="" be="" greater="" than="" 0",="" "width="" error",="" joptionpane.error_message);="" txtlength.settext("");="" txtlength.requestfocusinwindow();="" return="" false;="" }="" if="" (slength.equals(""))="" {="" joptionpane.showmessagedialog(this,="" "enter="" a="" length",="" "length="" error",="" joptionpane.error_message);="" txtlength.requestfocusinwindow();="" return="" false;="" }="" try="" {="" double.parsedouble(slength);="" }="" catch="" (numberformatexception="" e)="" {="" joptionpane.showmessagedialog(this,="" "length="" must="" be="" a="" number",="" "length="" error",="" joptionpane.error_message);="" txtlength.settext("");="" txtlength.requestfocusinwindow();="" return="" false;="" }="" if="" (double.parsedouble(slength)=""><= 0) { 0)="">
Answered Same DaySep 19, 2021

Answer To: Course Project DeVry University College of Engineering and Information Sciences Course Number:...

Anurag answered on Sep 20 2021
124 Votes
CIS355A_LASTNAME_Landscaping/pom.xml

4.0.0
com.mycompany
CIS355A_LASTNAME_Landscaping
1.0-SNAPSHOT
jar

UTF-8
16
16

CIS355A_LASTNAME_Landscaping/src/main/java/com/mycompany/cis355a_lastname_landscaping/assignment.form
































































































































































































































...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here