From de9cd056028579a965b819b8f2f13e0cfcdd352d Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Sun, 1 Sep 2019 18:57:31 +0200 Subject: [PATCH] Opening the new tab after starting a game --- src/dev/kske/chess/ui/MainWindow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dev/kske/chess/ui/MainWindow.java b/src/dev/kske/chess/ui/MainWindow.java index 3ce97f7..c5c2965 100644 --- a/src/dev/kske/chess/ui/MainWindow.java +++ b/src/dev/kske/chess/ui/MainWindow.java @@ -69,13 +69,14 @@ public class MainWindow { 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} */ public GamePane addGamePane() { GamePane gamePane = new GamePane(); tabbedPane.add("Game " + (tabbedPane.getComponentCount() + 1), gamePane); + tabbedPane.setSelectedIndex(tabbedPane.getComponentCount() - 1); return gamePane; } }