int (@NotNull TabbedContent content) { int selectedIndex = content.getSelectedIndex(); if (selectedIndex != -1) return selectedIndex; final JComponent current = content.getComponent(); int index = 0; for (Pair<String, JComponent> tab : content.getTabs()) { if (tab.second == current) { return index; } index++; } return -1; }