X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FMainWindowsView.java;h=18e1ba1e9c7b3bbce6e8f70f3d2a71723204db66;hb=64418ffb240e30ec22560aafd85b07792ac71c80;hp=406fcd58f18a8783375fa37e1670ff287367bd3a;hpb=476910abd64760223f3e4143866134e49facf487;p=Persons_Comparator.git diff --git a/src/MainWindowsView.java b/src/MainWindowsView.java index 406fcd5..18e1ba1 100644 --- a/src/MainWindowsView.java +++ b/src/MainWindowsView.java @@ -7,11 +7,22 @@ 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 static MainWindowsView getInstance() { + return ourInstance; + } + + public void setMainWindowsView(String title, PersonView personView) { + this.currentPersonView = personView; + Container panel = getContentPane(); //Create and set up the window. setTitle(title); - setSize(300, 300); + setSize(getCurrentPersonView().getDimension()); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -28,7 +39,15 @@ 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 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