Starting from:

$24

Write a Java program that constructs an Applet

Assignment #6 Important: This is an individual assignment. Please do not collaborate. No late assignment will be accepted. Make sure that you write every line of your code. Using code written by someone else will be considered a violation of the academic integrity and will result in a report to the Dean's office. Requirements to get full credits in Documentation
The assignment number, your name, student ID, lecture number, and a class/file description need to be included at the top of each file/class.
A description of each method is also needed.
Some additional comments inside of methods to explain code that are hard to follow should be written.
You can look at the Java programs in the text book to see how comments are added to programs. Minimal Submitted Files You are required, but not limited, to turn in the following source files: Assignment6.java (The Assignment6 class extends JApplet)
Project.java Budget.java
CreatePanel.java - to be completed (it extends JPanel and contains ButtonListener nested class)
ProjectSpendingPanel.java - to be completed (it extends JPanel and contains ButtonListener nested class)

You can download the above files and use them to complete this assignment. You might need to add more methods than the specified ones. Skills to be Applied: Swing/AWT, Vector (very similar to ArrayList class) Classes may be needed:
JApplet, JButton, JTextField, JTextArea, JLabel, Container, JPanel, JTabbedPane, JList, and ActionListener. You may use other classes. How to run an applet program: -Create an html file, say "hw6.html" with the following content:
-------------------------------------------------------- <html <head <titleAssignment 6 Applet</title </head <body <applet code="Assignment6.class" width=900 height=350 </applet </body </html ------------------------------------------------------

-Compile your java program as usual.

-In a console, type:

appletviewer hw6.html

(instead of typing "java Assignment6").

-In the TextPad, choose Tool-Run Java Applet or
press Ctrl-3 (press control key and 3 at the same time).

-In the jGrasp,
choose Run-Run as Applet. To test to see if your machine is set to view an applet, please go to the following site:
Click this page Program Description Suggested Class Diagram: Write a Java program that constructs an Applet. Your program should provide labels and textfields to a user to enter information regarding projects. The Applet (JApplet) of your program should contain two tabs. The first tab is labeled "Project creation" and the second tab is labeled "Project spending". (The size of the applet here is approximately 900 X 350). The section under the first tab should be divided into two parts: The left part contains labels, textfields, and a button for a user to enter some project information. The right part shows "No project" at the beginning (it is done usingJTextArea). A user can enter some project information, and push "Create a project" button. Then the project information should appear on the right hand side panel (note that the format of the project information can be using toString() method of the Project class). A message "Project added" should also appear with red color at the top of the panel. Error handling: 1. If a user forgets to enter some field and pushes "Create a project" button, show a message "Please fill all fields" with red color, and nothing should be added to the right hand side panel. 2. If a user enters a non-numeric value for project number or initial funding, and push "Create a project" button, show a message "Please enter a numeric value for project number and initial funding" with red color, and nothing should be added to the right hand side panel. After entering several projects, the applet will have the following appearance. Note that a scroll pane needs to be added to show multiple projects. Under the "Project spending" tab, a user can choose a project to specify spending. There should be a JList containing all projects created by Project creation panel and a user can choose a project within it by clicking it. Below the JList, there should be a JTextField where a user can enter some spending and a button to add some spending. The list of projects in the JList should be exactly same as the list under "Project creation" tab. A user can choose a project and specify its spending, then push " Submit Budget " button. After pushing the button, it should update the spending and current balance of the project as follows. Note that a scroll pane needs to be added to show the entire project information. Another user can add spending for other projects as well: A user should be able to go back and forth between "Project creation" tab and "Project spending" tab, and these two panels need to have consistent information, i.e., the same list of projects. Note that the list of projects created in the CreatePanel needs to be consistent in the list in ProjectSpendingPanel, but the spending and current balance updated in the ProjectSpendingPanel do not need to be reflected in CreatePanel. Class description ProjectSpendingPanel ProjectSpendingPanel class extends JPanel defined in javax.swing package. It should contain at least the following instance variable: Attribute name Attribute type Description projectList Vector a list of project objects. This class should have a constructor: public ProjectSpendingPanel(Vector projectList) where the parameter "projectList" is passed from the Assignment6 class. The constructor layouts and organizes components in this panel. You will be adding more variables (components) than what is listed here, including JList, labels, a textfield, and a button. The JList should be instantiated using the "projectList" vector. Then whenever the vector is updated, the JList will be updated as well by calling its updateUI() method. They will utilize the toString( ) method of the Project class to display each item. public void updateProjectList() This method calls updateUI() method for the JList that you will be creating. You need to instantiate your JList using the projectList in the constructor. The projectList will be constantly updated under the "Project creation" tab and when it is updated, this method should be called from the actionPerformed method in the ButtonListener of theCreatePanel class so that the JList under the "Project spending" will have the same update project list in them. This class contains a nested class called ButtonListener class that implements ActionListener interface. Thus you need to define its actionPerformed method that is supposed to update the spending and current balance, and display them when the "Add Spending" button is pushed. CreatePanel CreatePanel extends JPanel defined in the javax.swing package. It should contain at least the following instance variable: Attribute name Attribute type Description projectList Vector a list of Project objects. spendingPanel ProjectSpendingPanel an object of ProjectSpendingPanel. This class should have a constructor: public CreatePanel(Vector projectList, ProjectSpendingPanel spendingPanel) where the parameter "projectList" is passed from the Assignment6 class and the second parameter is an object of ProjectSpendingPanel. The constructor layouts and organizes components in this panel. You will be adding more variables (components) than what is listed here, including labels, textfields, a button, and a text area. This class contains a nested class called ButtonListener class that implements ActionListener interface. Thus the ButtonListener needs to have a definition foractionPerformed method that adds some project information to the list and does error handling. See the UML class diagram for the parameter and return type of this method. In the actionPerformed, you need to extract the information from the two textfields for the title and publisher. Then you can instantiate an object of the Project class using the information. You can use the toString( ) method of the Project object to display the information on the textarea on the right hand side and also add the Project object to the "projectList". Assignment6 class Assignment6 class extends JApplet defined in javax.swing package. It contains at least init() method (see UML diagram for its return type) to instantiate all instance variables and adds its components to itself. It also sets its size. It contains at least following instance variables: Attribute name Attribute type Description projectList Vector a list of project objects. It will be used in both createPanel and spendingPanel. spendingPanel ProjectSpendingPanel an object of ProjectSpendingPanel. createPanel CreatePanel an object of CreatePanel. tPane JTabbedPane an object of JTabbedPane. It will contain createPanel and spendingPanel under each tab. Grading Policy:
submit assignment on time
indicate assignment number, name, lecture number, and description of each class clearly in each submitted java file
your program minimally has the following functionalities:
2 points: Appropriate components such as textfields, labels, etc. are shown under the "Project creation" and "Project spending" tabs. JScrollPane is added to display the entire information on each Panel.
1 point: When the "Create a project" button is pushed, the project information from textfields is added on the right panel in the correct order and the message of "project added" shows up.
1 point: Error handing in case some field is not filled.
1 point: Error handing in case a non-numeric value is entered for projNumber or funding.
1 point: The same list of projects is shown under the "Project creation" tab and under the "Project spending" tab.
2 point: When the add spending button is pushed, the spending and current balance are updated correctly.

More products