public GUITable() throws Exception { main_frame = new JFrame("Card Games"); main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main_frame.setPreferredSize(new Dimension(357, 323)); main_frame.setResizable(false); main_menu = new TableMenu(); main_frame.setJMenuBar(main_menu); Container cp = main_frame.getContentPane(); cp.setLayout(new CardLayout()); JLabel base = new JLabel("Use the game menu to start a game"); base.setHorizontalAlignment(SwingConstants.CENTER); base.setVerticalAlignment(SwingConstants.CENTER); cp.add(base, "Base"); base.setSize(cp.getSize()); main_frame.pack(); main_frame.setVisible(true); game_gui = null; games = new Hashtable<String, TableUI>(); this.host = GUIPlayer.getCurrentPlayer(); if (this.host == null) { main_menu.showNewUserDialog(main_frame); this.host = GUIPlayer.getCurrentPlayer(); if (this.host != null) main_menu.enableGameMenus(); } else main_menu.enableGameMenus(); }
public void gameOver(String table_name) { TableUI game_ui = games.remove(table_name); if (game_ui != null) { main_frame.getContentPane().remove(game_ui); game_ui.removeAll(); main_menu.enableGameMenus(); } }