void (MouseEvent e) { if (e.getClickCount() == 2 && e.getSource() == myTable) { int row = myTable.getSelectedRow(); if (myTree.isCollapsed(row)) { myTree.expandRow(row); } else { myTree.collapseRow(row); } } }