Question
In Java, display two objects from an ArrayList with two attributes in a JTable. This Menu has three buttons on the bottom, add, edit, and
In Java, display two objects from an ArrayList with two attributes in a JTable. This Menu has three buttons on the bottom, add, edit, and exit. For Example:
Name | Color |
Banana | Yellow |
Apple | Red |
ADD(BUTTON ) EDIT(Button) EXIT (Button)
When the user highlights an object and clicks edit, another screen pops up to allow the user to enter new attributes for the object. The user should be able to enter any attribute name they would like.
For example, When the user highlights the word Banana another view appears and allows them to change the name of Banana to Grapefruit and to change the color to Pink. The user enters the attributes they wish to change into JTextFields. Afterwards, they can click an update button at the bottom to update the current object, click delete to remove the current object, or hit return to return to the main menu with the Jtable.
Example of Edit View:
Change Name to: Grapefruit (JtextField)
Change Color : Pink (JTextField)
Update(Button) Delete(Button) Return (Button)
The JTable from the Main Menu must now display the updated attributes.
Name | Color |
GrapeFruit | Pink |
Apple | Red |
ADD(BUTTON ) EDIT(Button) EXIT (Button)
When the user clicks the ADD button from the JTable, a separate view menu is displayed that allows the user to add a new object to the JTable menu through the use of JTextFeilds.
Example of Add View:
Add Name: Grape (JtextField)
Add Color : Purple (JTextField)
Update(Button) Return (Button)
When the user Clicks update, the Main JTable menu must now show the added object or simply return if no object was added.
Name | Color |
GrapeFruit | Pink |
Apple | Red |
Lemon | Yellow |
Grape | Purple |
ADD(BUTTON ) EDIT(Button) EXIT (Button)
Use a controller object to communicate between the view classes and Object classes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started