equal
deleted
inserted
replaced
11 |
11 |
12 import java.awt.Dimension |
12 import java.awt.Dimension |
13 import java.awt.event.{ComponentEvent, ComponentAdapter, FocusAdapter, FocusEvent, |
13 import java.awt.event.{ComponentEvent, ComponentAdapter, FocusAdapter, FocusEvent, |
14 MouseEvent, MouseAdapter} |
14 MouseEvent, MouseAdapter} |
15 import javax.swing.{JTree, JComponent} |
15 import javax.swing.{JTree, JComponent} |
16 import javax.swing.tree.{DefaultMutableTreeNode, DefaultTreeModel, TreeSelectionModel} |
16 import javax.swing.tree.{DefaultMutableTreeNode, DefaultTreeModel} |
17 import javax.swing.event.TreeSelectionEvent |
17 import javax.swing.event.TreeSelectionEvent |
18 |
18 |
19 import scala.swing.{Component, ScrollPane, SplitPane, Orientation} |
19 import scala.swing.{Component, ScrollPane, SplitPane, Orientation} |
20 import scala.swing.event.ButtonClicked |
20 import scala.swing.event.ButtonClicked |
21 |
21 |
27 |
27 |
28 |
28 |
29 /* tree view */ |
29 /* tree view */ |
30 |
30 |
31 val root: DefaultMutableTreeNode = new DefaultMutableTreeNode(root_name) |
31 val root: DefaultMutableTreeNode = new DefaultMutableTreeNode(root_name) |
32 val tree: JTree = GUI.init_tree(root) |
32 val tree: JTree = GUI.init_tree(root, single_selection_mode = true) |
33 |
33 |
34 def get_tree_selection[A](which: PartialFunction[AnyRef, A]): Option[A] = |
34 def get_tree_selection[A](which: PartialFunction[AnyRef, A]): Option[A] = |
35 tree.getLastSelectedPathComponent match { |
35 tree.getLastSelectedPathComponent match { |
36 case node: DefaultMutableTreeNode => |
36 case node: DefaultMutableTreeNode => |
37 val obj = node.getUserObject |
37 val obj = node.getUserObject |
48 } |
48 } |
49 |
49 |
50 def reload(): Unit = |
50 def reload(): Unit = |
51 tree.getModel.asInstanceOf[DefaultTreeModel].reload(root) |
51 tree.getModel.asInstanceOf[DefaultTreeModel].reload(root) |
52 |
52 |
53 tree.getSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION) |
|
54 tree.addTreeSelectionListener((e: TreeSelectionEvent) => handle_tree_selection(e)) |
53 tree.addTreeSelectionListener((e: TreeSelectionEvent) => handle_tree_selection(e)) |
55 |
54 |
56 |
55 |
57 /* text area */ |
56 /* text area */ |
58 |
57 |