diff --git a/src/main/java/mediathek/mainwindow/MediathekGui.java b/src/main/java/mediathek/mainwindow/MediathekGui.java index 281872096..bd5bf9e5a 100644 --- a/src/main/java/mediathek/mainwindow/MediathekGui.java +++ b/src/main/java/mediathek/mainwindow/MediathekGui.java @@ -84,6 +84,7 @@ public class MediathekGui extends JFrame { private static final int MIN_WINDOW_HEIGHT = 600; private static final String ACTION_MAP_KEY_COPY_HQ_URL = "COPY_HQ_URL"; private static final String ACTION_MAP_KEY_COPY_NORMAL_URL = "COPY_NORMAL_URL"; + private static final String TABBED_PANE_TRAILING_COMPONENT = "JTabbedPane.trailingComponent"; /** * "Pointer" to UI */ @@ -146,6 +147,7 @@ public class MediathekGui extends JFrame { private IndicatorThread progressIndicatorThread; private AutomaticFilmlistUpdate automaticFilmlistUpdate; private boolean shutdownRequested; + public MediathekGui() { ui = this; @@ -238,7 +240,6 @@ public MediathekGui() { try { TimeUnit.SECONDS.sleep(10); logger.info("Auto DL and Quit: Updating filmlist..."); - final var daten = Daten.getInstance(); daten.getListeFilme().clear(); // sonst wird evtl. nur eine Diff geladen daten.getFilmeLaden().loadFilmlist("", false); logger.info("Auto DL and Quit: Filmlist update done."); @@ -283,6 +284,15 @@ public void onFailure(@NotNull Throwable t) { performAustrianVlcCheck(); } + /** + * Return the user interface instance + * + * @return the class instance or null. + */ + public static MediathekGui ui() { + return ui; + } + private void performAustrianVlcCheck() { //perform check only when we are not in download-only mode... if (!Config.shouldDownloadAndQuit()) { @@ -307,15 +317,6 @@ private void subscribeTableModelChangeEvent() { messageBus.subscribe(this); } - /** - * Return the user interface instance - * - * @return the class instance or null. - */ - public static MediathekGui ui() { - return ui; - } - private void mapFilmUrlCopyCommands() { final var im = jMenuBar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_H, GuiFunktionen.getPlatformControlKey() | @@ -368,7 +369,7 @@ protected void setToolBarProperties() { } protected void installToolBar() { - tabbedPane.putClientProperty("JTabbedPane.trailingComponent", commonToolBar); + tabbedPane.putClientProperty(TABBED_PANE_TRAILING_COMPONENT, commonToolBar); tabbedPane.putClientProperty("JTabbedPane.tabRotation", "auto"); } @@ -688,7 +689,6 @@ private void restoreSizeFromConfig() { /* We are not in maximized mode, so just read all the settings and restore... */ - var config = ApplicationConfiguration.getConfiguration(); try { config.lock(LockMode.READ); int width = config.getInt(ApplicationConfiguration.APPLICATION_UI_MAINWINDOW_WIDTH, MIN_WINDOW_WIDTH); @@ -854,11 +854,11 @@ protected void configureTabPlacement() { if (topPosition) { tabbedPane.setTabPlacement(JTabbedPane.TOP); getContentPane().remove(commonToolBar); - tabbedPane.putClientProperty("JTabbedPane.trailingComponent", commonToolBar); + tabbedPane.putClientProperty(TABBED_PANE_TRAILING_COMPONENT, commonToolBar); } else { tabbedPane.setTabPlacement(JTabbedPane.LEFT); - tabbedPane.putClientProperty("JTabbedPane.trailingComponent", null); + tabbedPane.putClientProperty(TABBED_PANE_TRAILING_COMPONENT, null); getContentPane().add(commonToolBar, BorderLayout.PAGE_START); } } @@ -1093,7 +1093,7 @@ private void createDeveloperMenu() { JMenu devMenu = new JMenu("Entwickler"); JMenuItem miGc = new JMenuItem("GC ausführen"); - miGc.addActionListener(l -> System.gc()); + miGc.addActionListener(_ -> System.gc()); devMenu.add(miGc);