public MetricCategory getSelectedCategory() { final Component component = tabbedPane.getSelectedComponent(); for (MetricCategory category : MetricCategory.values()) { final JTable table = tables.get(category); if (table.getParent().getParent().equals(component)) { return category; } } return null; }