public void mousePressed(MouseEvent e) { TreePath currentPath = dialog.optionTree.getPathForLocation(e.getX(), e.getY()); if (currentPath == null) return; dialog.optionTree.setSelectionPath(currentPath); DefaultMutableTreeNode node = (DefaultMutableTreeNode) currentPath.getLastPathComponent(); currentTabName = (String) node.getUserObject(); dialog.optionTree.expandPath(currentPath); if (!currentTabName.endsWith(" ")) { dialog.loadOptionPanel(); } dialog.pack(); }
public void treeExpanded(TreeExpansionEvent e) { TreePath tp = e.getPath(); if (tp.getPathCount() == 2) { // opened a path down to the bottom: close all others TreePath topPath = dialog.optionTree.getPathForRow(0); DefaultMutableTreeNode node = (DefaultMutableTreeNode) topPath.getLastPathComponent(); int numChildren = node.getChildCount(); for (int i = 0; i < numChildren; i++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) node.getChildAt(i); TreePath descentPath = topPath.pathByAddingChild(child); if (!descentPath.getLastPathComponent().equals(tp.getLastPathComponent())) { dialog.optionTree.collapsePath(descentPath); } } } dialog.pack(); }
/** This method implements the command to show the Technology Creation Wizard dialog. */ public static void techEditWizardCommand() { TechEditWizard dialog = new TechEditWizard((Frame) Main.getCurrentJFrame()); dialog.setVisible(true); }
public void treeCollapsed(TreeExpansionEvent e) { dialog.pack(); }