MessageNode () { TreePath path = myTree.getSelectionPath(); if (path == null) return null; if (!(path.getLastPathComponent()instanceof MessageNode)) return null; return (MessageNode)path.getLastPathComponent(); }