| 1 | import javax.swing.*; |
| 2 | |
| 3 | public class MainWindowsView extends JFrame { |
| 4 | MainWindowsView(String title) { |
| 5 | //Create and set up the window. |
| 6 | setTitle(title); |
| 7 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 8 | |
| 9 | JPanel panel = new PersonView(); |
| 10 | |
| 11 | //TODO: Add content to the panel |
| 12 | //JLabel label = new JLabel("Hello World"); |
| 13 | //panel.add(label); |
| 14 | |
| 15 | getContentPane().add(panel); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Show the GUI. For thread safety, |
| 20 | * this method should be invoked from the |
| 21 | * event-dispatching thread. |
| 22 | */ |
| 23 | public void showGUI() { |
| 24 | |
| 25 | //Display the window. |
| 26 | this.pack(); |
| 27 | this.setVisible(true); |
| 28 | } |
| 29 | |
| 30 | } |