1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

makeup: factor call to tabs.get(index)

This commit is contained in:
Cristian Maglie 2021-08-18 12:00:38 +02:00
parent 240e1b5624
commit af5a3d7801

View File

@ -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