We need a dialog that allows a user to view the products that have been entered into the system. Take a quick look at the mock-up of this dialog in the product specification document (section 188.8.131.52) so that you know what you are aiming for.
Add a new issue to GitBucket. We are about to start work on the dialog that allows the user to view the products, so name/describe the issue appropriately.
Create a new
JDialog in the
gui package named
Add a Scroll Pane from the Swing Containers palette to the form. It should take up most of the form leaving a little bit at the top for the search and filter components, and a little bit of room at the bottom for then buttons. You can resize this later once you have added the other components.
Add a List (
JList) component to the scroll pane. A JList component is able to display a collection of objects and allow the user to select one. It is similar to a combobox but is expanded by default whereas a user needs to click the drop-down button to expand a combobox.
Add a button for closing the dialog and set the variable name and text of the button to appropriate values. Make sure it is attached to one of the dialog's bottom snap boundaries.
Resize the scroll pane so it snaps to the top of the button. This will make the scroll pane and list resize vertically when the form is resized. You should make sure that the scroll pane will also resize horizontally.
Add a button click handler to the close button that closes the form by calling
Now you can add a button handler to the <> button in the
MainMenuframe that will display the
Test your modification to the main menu by running the application.
Now is a good time to commit. We haven't finished with this class, so don't close the issue just yet. This is the last time that we will tell you to commit. From now on you should use your own judgement on when to commit and create issues. Remember to reference the associated issue --- if you are doing things correctly then pretty much every commit should reference a corresponding issue.
Try to get into the habit of using the issues list on GitBucket as your to-do list for the project.