From af5a3d7801bbb681c36ac4297c54299e646740d7 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 18 Aug 2021 12:00:38 +0200 Subject: [PATCH] makeup: factor call to tabs.get(index) --- app/src/processing/app/Editor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index eabeac18e..3b3316f31 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -1450,9 +1450,10 @@ public class Editor extends JFrame implements RunnerListener { // This must be run in the GUI thread SwingUtilities.invokeLater(() -> { codePanel.removeAll(); - codePanel.add(tabs.get(index), BorderLayout.CENTER); - tabs.get(index).requestFocusInWindow(); // get the caret blinking - tabs.get(index).applyPreferences(); + EditorTab selectedTab = tabs.get(index); + codePanel.add(selectedTab, BorderLayout.CENTER); + selectedTab.applyPreferences(); + selectedTab.requestFocusInWindow(); // get the caret blinking // For some reason, these are needed. Revalidate says it should be // automatically called when components are added or removed, but without // it, the component switched to is not displayed. repaint() is needed to