private static JTree createTree() { JTree resultsTree = new JTree(); resultsTree.setName("TREEVIEW"); resultsTree.setRootVisible(false); resultsTree.setEditable(false); resultsTree.setShowsRootHandles(true); resultsTree.setCellRenderer(new FailureCellRenderer()); ToolTipManager tipManager = ToolTipManager.sharedInstance(); tipManager.registerComponent(resultsTree); resultsTree.addKeyListener(new EnterPressListener()); return resultsTree; }
/** * Initialize the common user interface components. * * <p> */ protected JButton[] initUI( String title, JComponent extraComps, String confirm, String[][] extra, String cancel) { JButton[] extraBtns = null; /* create dialog body components */ { JPanel body = new JPanel(); body.setName("MainDialogPanel"); body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS)); body.add(UIFactory.createPanelLabel("Existing Layouts:")); body.add(Box.createRigidArea(new Dimension(0, 4))); { DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeData(), true); DefaultTreeModel model = new DefaultTreeModel(root, true); JTree tree = new JFancyTree(model); pTree = tree; tree.setName("DarkTree"); tree.setCellRenderer(new JLayoutTreeCellRenderer()); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); { JScrollPane scroll = UIFactory.createScrollPane( pTree, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, new Dimension(230, 120), new Dimension(230, 150), null); body.add(scroll); } } if (extraComps != null) body.add(extraComps); extraBtns = super.initUI(title, body, confirm, null, extra, cancel); } return extraBtns; }