MCPcopy
hub / github.com/arduino/Arduino / selectTab

Method selectTab

app/src/processing/app/Editor.java:1445–1466  ·  view source on GitHub ↗

Change the currently displayed tab. Note that the GUI might not update immediately, since this needs to run in the Event dispatch thread. @param index The index of the tab to select

(final int index)

Source from the content-addressed store, hash-verified

1443 * @param index The index of the tab to select
1444 */
1445 public void selectTab(final int index) {
1446 currentTabIndex = index;
1447 updateUndoRedoState();
1448 updateTitle();
1449 header.rebuild();
1450 getCurrentTab().activated();
1451
1452 // This must be run in the GUI thread
1453 SwingUtilities.invokeLater(() -> {
1454 codePanel.removeAll();
1455 EditorTab selectedTab = tabs.get(index);
1456 codePanel.add(selectedTab, BorderLayout.CENTER);
1457 selectedTab.applyPreferences();
1458 selectedTab.requestFocusInWindow(); // get the caret blinking
1459 // For some reason, these are needed. Revalidate says it should be
1460 // automatically called when components are added or removed, but without
1461 // it, the component switched to is not displayed. repaint() is needed to
1462 // clear the entire text area of any previous text.
1463 codePanel.revalidate();
1464 codePanel.repaint();
1465 });
1466 }
1467
1468 public void selectNextTab() {
1469 selectTab((currentTabIndex + 1) % tabs.size());

Callers 11

selectNextTabMethod · 0.95
selectPrevTabMethod · 0.95
createTabsMethod · 0.95
statusErrorMethod · 0.95
replaceAllMethod · 0.80
mousePressedMethod · 0.80
rebuildMenuMethod · 0.80
nameCodeMethod · 0.80
handleDeleteCodeMethod · 0.80
addFileMethod · 0.80
importLibraryMethod · 0.80

Calls 9

updateUndoRedoStateMethod · 0.95
updateTitleMethod · 0.95
getCurrentTabMethod · 0.95
applyPreferencesMethod · 0.95
requestFocusInWindowMethod · 0.95
rebuildMethod · 0.80
activatedMethod · 0.80
getMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected