Opening the new tab after starting a game

This commit is contained in:
Kai S. K. Engelbart 2019-09-01 18:57:31 +02:00
parent 5ecbeb7677
commit 15fc153dac
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13

View File

@ -69,13 +69,14 @@ public class MainWindow {
public GamePane getSelectedGamePane() { return (GamePane) tabbedPane.getSelectedComponent(); } public GamePane getSelectedGamePane() { return (GamePane) tabbedPane.getSelectedComponent(); }
/** /**
* Creates a new {@link GamePane} and adds it to the tabbed pane. * Creates a new {@link GamePane}, adds it to the tabbed pane and opens it.
* *
* @return The new {@link GamePane} * @return The new {@link GamePane}
*/ */
public GamePane addGamePane() { public GamePane addGamePane() {
GamePane gamePane = new GamePane(); GamePane gamePane = new GamePane();
tabbedPane.add("Game " + (tabbedPane.getComponentCount() + 1), gamePane); tabbedPane.add("Game " + (tabbedPane.getComponentCount() + 1), gamePane);
tabbedPane.setSelectedIndex(tabbedPane.getComponentCount() - 1);
return gamePane; return gamePane;
} }
} }