public Optional<LogViewPanelI> getSelectedLogViewPanel() {
    int selectedIndex = jTabbedPane.getSelectedIndex();
    if (selectedIndex >= 0) {
      Component componentAt = jTabbedPane.getComponentAt(selectedIndex);
      if (componentAt instanceof LogViewPanelWrapper) {
        LogViewPanelWrapper logViewPanelWrapper = (LogViewPanelWrapper) componentAt;
        return Optional.of(logViewPanelWrapper.getLogViewPanel());
      } else if (componentAt instanceof LogPatternParserEditor) {
        LogPatternParserEditor patternParserEditor = (LogPatternParserEditor) componentAt;
        return Optional.of(patternParserEditor.getLogViewPanel());
      }
    }
    return Optional.empty();
  }
Created by IntelliJ IDEA.
User: Krzysztof Otrebski
Date: 3/29/12
Time: 6:57 AM
olv-core/src/main/java/pl/otros/logview/api/OtrosApplication.java