MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / addTab

Method addTab

src/org/opensourcephysics/tools/DataTool.java:2112–2131  ·  view source on GitHub ↗

Adds a tab. The tab should be named before calling this method. @param tab a DataToolTab

(final DataToolTab tab)

Source from the content-addressed store, hash-verified

2110 * @param tab a DataToolTab
2111 */
2112 public void addTab(final DataToolTab tab) {
2113 // remove single empty tab, if any
2114 if (getTabCount() == 1) {
2115 DataToolTab prev = getTab(0);
2116 if (prev.originatorID == 0) {
2117 prev.tabChanged(false);
2118 removeTab(0, false);
2119 }
2120 }
2121 tab.dataTool = this;
2122 // assign a unique name (also traps for null name)
2123 tab.setName(getUniqueTabName(tab.getName()));
2124 //OSPLog.finer("adding tab " + tab.getName()); //$NON-NLS-1$
2125 tabbedPane.addTab("", tab); //$NON-NLS-1$
2126 tab.setFontLevel(FontSizer.getLevel());
2127 tabbedPane.setSelectedComponent(tab);
2128 // validate();
2129 refreshTabTitles();
2130 refreshMenubar();
2131 }
2132
2133 /**
2134 * Offers to save changes to the tab at the specified index.

Callers 15

DataToolMethod · 0.95
addTabsMethod · 0.95
acceptMethod · 0.95
loadDataMethod · 0.95
openMethod · 0.95
loadDatasetMethod · 0.95
sendMethod · 0.95
actionPerformedMethod · 0.95
pasteActionMethod · 0.95
windowOpenedMethod · 0.45
createGUIMethod · 0.45
doneMethod · 0.45

Calls 11

getTabCountMethod · 0.95
getTabMethod · 0.95
tabChangedMethod · 0.95
removeTabMethod · 0.95
getUniqueTabNameMethod · 0.95
getLevelMethod · 0.95
refreshTabTitlesMethod · 0.95
refreshMenubarMethod · 0.95
setNameMethod · 0.65
getNameMethod · 0.65
setFontLevelMethod · 0.45

Tested by

no test coverage detected