Reorganize the PersonView :
[Persons_Comparator.git] / src / MainWindowsView.java
index 85470ff4636bc67730f5ca54eff5d8e34cc38af9..df6839f9813916af37709317683a550835ca2046 100644 (file)
@@ -8,10 +8,11 @@ import java.util.ArrayList;
 
 public class MainWindowsView extends JFrame {
 
-    MainWindowsView(String title, JPanel panel) {
+    MainWindowsView(String title, PersonView view) {
+        Container panel = getContentPane();
         //Create and set up the window.
         setTitle(title);
-        setSize(panel.getPreferredSize());
+        setSize(view.getDimension());
         setLocationRelativeTo(null);
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
@@ -28,7 +29,11 @@ public class MainWindowsView extends JFrame {
             panel.add(component);
         }
 
-        setContentPane(panel);
+        panel.add(view.getNorthPanel(), BorderLayout.NORTH);
+        panel.add(view.getSouthPanel(), BorderLayout.SOUTH);
+        panel.add(view.getEastPanel(), BorderLayout.EAST);
+        panel.add(view.getWestPanel(), BorderLayout.WEST);
+        panel.add(view.getPersonPanel(), BorderLayout.CENTER);
     }
 
     /**
@@ -77,7 +82,8 @@ public class MainWindowsView extends JFrame {
      * event-dispatching thread.
      */
     public void showGUI() {
-
+        System.out.println("Created GUI on EDT? " +
+                SwingUtilities.isEventDispatchThread());
         //Display the window.
         //this.pack();
         this.setVisible(true);