X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FMainWindowsView.java;h=703792124cb31db55c285d7cd3ff79d65e9c00ec;hb=7add5cb9b2213df01b559a59f39b033e27f50e72;hp=85470ff4636bc67730f5ca54eff5d8e34cc38af9;hpb=bb6c655ae5fafc833209b3950b3e69e8f539a42a;p=Persons_Comparator.git diff --git a/src/MainWindowsView.java b/src/MainWindowsView.java index 85470ff..7037921 100644 --- a/src/MainWindowsView.java +++ b/src/MainWindowsView.java @@ -7,11 +7,18 @@ import java.awt.event.KeyEvent; import java.util.ArrayList; public class MainWindowsView extends JFrame { + private static MainWindowsView ourInstance = new MainWindowsView(); + private PersonView currentPersonView; - MainWindowsView(String title, JPanel panel) { + private MainWindowsView() { + } + + public void setMainWindowsView(String title, PersonView personView) { + this.currentPersonView = personView; + Container panel = getContentPane(); //Create and set up the window. setTitle(title); - setSize(panel.getPreferredSize()); + setSize(getCurrentPersonView().getDimension()); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -28,7 +35,19 @@ public class MainWindowsView extends JFrame { panel.add(component); } - setContentPane(panel); + panel.add(getCurrentPersonView().getNorthPanel(), BorderLayout.NORTH); + panel.add(getCurrentPersonView().getSouthPanel(), BorderLayout.SOUTH); + panel.add(getCurrentPersonView().getEastPanel(), BorderLayout.EAST); + panel.add(getCurrentPersonView().getWestPanel(), BorderLayout.WEST); + panel.add(getCurrentPersonView().getPersonPanel(), BorderLayout.CENTER); + } + + public static MainWindowsView getInstance() { + return ourInstance; + } + + public PersonView getCurrentPersonView() { + return currentPersonView; } /** @@ -77,9 +96,10 @@ 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.pack(); this.setVisible(true); } } \ No newline at end of file