List of usage examples for javax.swing JTree addMouseListener
public synchronized void addMouseListener(MouseListener l)
From source file:org.richie.codeGen.ui.CodeGenMainUI.java
/** * @param list/*from w ww .j a va 2s .co m*/ * @return */ private JTree initTreeData(List<Table> list) { TableTreeNode root = null; if (list == null || list.size() == 0) { root = new TableTreeNode(""); } else { root = new TableTreeNode(list.get(0).getDataBaseCode() + ":" + list.get(0).getDataBaseName()); for (Table table : list) { list.get(0).getDataBaseName(); TableTreeNode node = new TableTreeNode(table); root.add(node); List<Column> columnList = table.getFields(); for (Column column : columnList) { TableTreeNode columnNode = new TableTreeNode(column); node.add(columnNode); } } } JTree newTree = new JTree(root); newTree.setCellRenderer(new TableTreeRender()); newTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { doMouseClicked(me); } }); return newTree; }