1: package siege.gui.views;
2:
3:
4: import java.awt.ComponentOrientation;
5: import java.awt.GridBagConstraints;
6: import java.awt.GridBagLayout;
7: import javax.swing.JFrame;
8: import javax.swing.JLayeredPane;
9: import javax.swing.JMenuBar;
10: import siege.util.*;
11:
12:
13: 14: 15: 16: 17:
18: public class FrontView extends JFrame
19: {
20: 21: 22:
23: public MainMenuView mainMenu;
24: public PlayboardView playboard;
25: public TerritoriesView territories;
26: public ChatView chat;
27: public StatusView status;
28:
29: 30: 31:
32: private static FrontView instance;
33:
34: 35: 36:
37: private FrontView()
38: {
39: setTitle("Siege");
40: setResizable(false);
41: setDefaultCloseOperation(EXIT_ON_CLOSE);
42:
43: 44: mainMenu = new MainMenuView();
45: setJMenuBar(mainMenu);
46:
47: 48: JLayeredPane layeredPane = new JLayeredPane();
49: layeredPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
50: layeredPane.setLayout(new GridBagLayout());
51:
52: 53: GridBagConstraints gbc = new GridBagConstraints();
54: gbc.fill = GridBagConstraints.BOTH;
55: gbc.ipady = 0;
56:
57: 58: gbc.gridwidth = 2;
59: gbc.weightx = 0;
60: gbc.weighty = 3;
61: gbc.gridx = 0;
62: gbc.gridy = 0;
63: playboard = new PlayboardView();
64: layeredPane.add(playboard, gbc, 3);
65: territories = new TerritoriesView();
66: layeredPane.add(territories, gbc, 2);
67:
68: 69: gbc.gridwidth = 1;
70: gbc.weightx = 1;
71: gbc.weighty = 1;
72: gbc.gridx = 0;
73: gbc.gridy = 1;
74: status = new StatusView();
75: layeredPane.add(status, gbc, 0);
76:
77: 78: gbc.gridwidth = 1;
79: gbc.weightx = 4;
80: gbc.weighty = 1;
81: gbc.gridx = 1;
82: gbc.gridy = 1;
83: chat = new ChatView();
84: layeredPane.add(chat, gbc, 0);
85:
86: 87: setContentPane(layeredPane);
88:
89: pack();
90: ViewHelper.centerWindow(this);
91: setVisible(true);
92: }
93:
94: 95: 96:
97: public static FrontView getInstance()
98: {
99: if(instance == null) {
100: instance = new FrontView();
101: }
102: return instance;
103: }
104:
105: public void initialize()
106: {
107: mainMenu.initialize();
108: playboard.initialize();
109: territories.initialize();
110: chat.initialize();
111: status.initialize();
112: Log.message(this,"initialize");
113: }
114: }
115: