Part 1 - The Main Window
This part is concerned with constructing a main window for the stock control application. Don't get too serious with the idea of stock control. The most important thing of this assignment is to get some experience of layouts and components in Swing.
Construct the main window following the example shown in picture 1. You don' have to add any functionality or event-handling into the components. Those subjects are dealt with in the latter parts. Concentrate on making a decent layout. Your class should inherit the JFrame and the class should be "StockControlApplication". There should be also a main method in this class
The application should have a button for adding a new product, changing product information and deleting a product. Buttons for handling an order and exiting the application are needed as well.
There should be a list of products and a text area for showing product information. The list has to be scrollable when there are more products than the list can show at once. You can use the class Product to generate elements for the list.
The example in figure1-1 has a separate panel for buttons that uses GridLayout. The empty space has been achieved by using the method setVgap(int height). The list and the text area have their own panel with a BorderLayout. The empty space between the text area and the list is there thanks to a Strut constructed with a method from the class Box. The content pane of the JFrame that holds both the panels has a BorderLayout, so adding a strut to the center is again an easy way to get some empty space.
Grading
Ceilidh will look especially following topics
- All the titles and labels are exactly like in the example (frame title should be the same as in the example)
- Layout and using empty space in your layout
- Scrollable product list
Get information on these
- JButton
- JPanel
- JScrollPane
- JTextArea
- JList, DefaultListModel
- JFrame
- BorderLayout, GridLayout, Box
Figure 1-1. Main window of the application.Other parts
Part 2 - Product Information and Event-Handling
Part 3. Window for Editing Product Information
Part 4. Menus and Confirmations
Part 5. Feedback questionnaire (compulsory)