当前位置: 首页>>代码示例>>Java>>正文


Java JTree.setShowsRootHandles方法代码示例

本文整理汇总了Java中javax.swing.JTree.setShowsRootHandles方法的典型用法代码示例。如果您正苦于以下问题:Java JTree.setShowsRootHandles方法的具体用法?Java JTree.setShowsRootHandles怎么用?Java JTree.setShowsRootHandles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTree的用法示例。


在下文中一共展示了JTree.setShowsRootHandles方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildTree

import javax.swing.JTree; //导入方法依赖的package包/类
/**
 * 
 */
private void buildTree() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("user");
    tree = new JTree(root);
    tree.putClientProperty("JTree.lineStyle", "Angled");
    tree.setCellRenderer(new NavigationTreeCellRenderer());
    tree.setShowsRootHandles(true);
    
    DefaultTreeSelectionModel model = new DefaultTreeSelectionModel();
    model.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    
    graphsCategory = new DefaultMutableTreeNode("graphs");
    
    mouseAdapter = new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            itemSelected(e);
        }
    };
    tree.addMouseListener(mouseAdapter);
    
    root.add(graphsCategory);        
    loadGraphs();
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:26,代码来源:NavigationView.java

示例2: createLeftPanel

import javax.swing.JTree; //导入方法依赖的package包/类
private synchronized Component createLeftPanel() {
    SampleResult rootSampleResult = new SampleResult();
    rootSampleResult.setSampleLabel("Root");
    rootSampleResult.setSuccessful(true);
    root = new SearchableTreeNode(rootSampleResult, null);

    treeModel = new DefaultTreeModel(root);
    jTree = new JTree(treeModel);
    jTree.setCellRenderer(new ResultsNodeRenderer());
    jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    jTree.addTreeSelectionListener(this);
    jTree.setRootVisible(false);
    jTree.setShowsRootHandles(true);
    JScrollPane treePane = new JScrollPane(jTree);
    treePane.setPreferredSize(new Dimension(200, 300));

    VerticalPanel leftPane = new VerticalPanel();
    leftPane.add(treePane, BorderLayout.CENTER);
    leftPane.add(createComboRender(), BorderLayout.NORTH);
    autoScrollCB = new JCheckBox(JMeterUtils.getResString("view_results_autoscroll")); // $NON-NLS-1$
    autoScrollCB.setSelected(false);
    autoScrollCB.addItemListener(this);
    leftPane.add(autoScrollCB, BorderLayout.SOUTH);
    return leftPane;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:26,代码来源:ViewResultsFullVisualizer.java

示例3: manipulateJTree

import javax.swing.JTree; //导入方法依赖的package包/类
/**
 * This method aids in the creation of the JTrees which are used to add in
 * the JTabbedPane component
 *
 * @param top
 *            - input to the JTree which will be formatted for display
 * @return JTree which will be used for adding to the root of a pane
 */
private JTree manipulateJTree(final DefaultMutableTreeNode top) {
	final JTree resultsTree = new JTree(top) {
		private static final long serialVersionUID = 1748421292182815368L;

		@Override
		public Insets getInsets() {
			return new Insets(5, 5, 5, 5);
		}
	};

	resultsTree.setRootVisible(false);
	resultsTree.setShowsRootHandles(true);

	if (resultsTree.getRowCount() > 0) {
		resultsTree.expandRow(0);
	}

	return resultsTree;
}
 
开发者ID:orionhealth,项目名称:rlc-analyser,代码行数:28,代码来源:RLCTreeBuilder.java

示例4: DynamicTree

import javax.swing.JTree; //导入方法依赖的package包/类
public DynamicTree() {
    super(new GridLayout(1, 0));

    rootNode = new DefaultMutableTreeNode("Root Node");
    treeModel = new DefaultTreeModel(rootNode);
    treeModel.addTreeModelListener(new MyTreeModelListener());
    tree = new JTree(treeModel);
    tree.setEditable(true);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);

    JScrollPane scrollPane = new JScrollPane(tree);
    add(scrollPane);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:DynamicTree.java

示例5: TreePanel

import javax.swing.JTree; //导入方法依赖的package包/类
public TreePanel()
{
	query = new JTextField();
	query.addActionListener(this);

	search = new JButton(CurrentLocale.get("searching.userGroupRole.executeQuery"));
	search.addActionListener(this);

	JPanel panel = new JPanel();
	panel.setLayout(new BorderLayout(5, 5));
	panel
		.add(new JLabel(CurrentLocale.get("com.tle.admin.recipients.browserfinder.groups")), BorderLayout.WEST);
	panel.add(query, BorderLayout.CENTER);
	panel.add(search, BorderLayout.EAST);

	model = new DefaultTreeModel(null);
	tree = new JTree(model);

	setLayout(new BorderLayout(5, 5));
	add(panel, BorderLayout.NORTH);
	add(new JScrollPane(tree), BorderLayout.CENTER);

	tree.addMouseListener(mouse);
	tree.setShowsRootHandles(true);
	tree.setRootVisible(false);
	tree.addTreeSelectionListener(this);
}
 
开发者ID:equella,项目名称:Equella,代码行数:28,代码来源:BrowseFinder.java

示例6: init

import javax.swing.JTree; //导入方法依赖的package包/类
void init(String layersXMLName) throws IOException {
		Vector layers = ParseLink.parse(URLFactory.url(haxby.map.MapApp.TEMP_BASE_URL + "GMA/Layers/" + layersXMLName));
	//	ParseLink.printProperties( layers, 0);
		rootEntry = new LayerEntry(null, new Vector(), "layers", "", null);
		layers = ParseLink.getProperties( layers, "layer");
		for( int i=0 ; i<layers.size() ; i++) {
			addLayers( (Vector)layers.get(i), rootEntry);
		}
		layerTree = new JTree(rootEntry);
		layerTree.setRootVisible(false);
		layerTree.setShowsRootHandles(true);
/*
		layerTree.addMouseListener( new MouseAdapter() {
			public void mouseReleased(MouseEvent e) {
				if(e.isPopupTrigger()) {
					popup(e);
				}
			}
			public void mousePressed(MouseEvent e) {
				if(e.isPopupTrigger()) {
					popup(e);
				}
			}
		});
*/
		renderer = new JLabel("");
		renderer.setOpaque(true);
	//	layerTree.setCellRenderer(this);
	//	layerTree.setBackground( new Color(215,215,215) );
		renderer.setBackground( new Color(225,225,255) );
		pop = new JPopupMenu();
		popLabel = new JLabel("");
		popLabel.setHorizontalAlignment( JLabel.CENTER );
		on = new JCheckBoxMenuItem( "display");
		pop.add( popLabel );
		pop.addSeparator();
		pop.add( on );
		pop.add( "edit properties");
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:40,代码来源:LayerModel.java

示例7: initializeTree

import javax.swing.JTree; //导入方法依赖的package包/类
private void initializeTree() {
    tree = new JTree();
    tree.setCellRenderer(new CustomTreeRenderer());
    tree.setVisibleRowCount(8);
    tree.setBackground(background);
    tree.addTreeSelectionListener(this);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);

}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:11,代码来源:JTreeComboBox.java

示例8: createDocPane

import javax.swing.JTree; //导入方法依赖的package包/类
private JTree createDocPane() {
    final DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    for (Map.Entry<?,? extends List<?>> docEntry : getDoc().getItemTree()
        .entrySet()) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(docEntry.getKey());
        root.add(node);
        for (Object rule : docEntry.getValue()) {
            node.add(new DefaultMutableTreeNode(rule));
        }
    }
    final JTree result = new JTree(root) {
        @Override
        public String getToolTipText(MouseEvent evt) {
            if (getRowForLocation(evt.getX(), evt.getY()) == -1) {
                return null;
            }
            TreePath curPath = getPathForLocation(evt.getX(), evt.getY());
            Object userObject =
                ((DefaultMutableTreeNode) curPath.getLastPathComponent()).getUserObject();
            return getToolTip(userObject);
        }
    };
    result.setRootVisible(false);
    result.setShowsRootHandles(true);
    DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) result.getCellRenderer();
    renderer.setBackgroundNonSelectionColor(null);
    renderer.setBackgroundSelectionColor(null);
    renderer.setTextSelectionColor(null);
    renderer.setLeafIcon(null);
    renderer.setClosedIcon(null);
    renderer.setOpenIcon(null);
    result.setCellRenderer(renderer);
    ToolTipManager.sharedInstance()
        .registerComponent(result);
    result.addMouseListener(new DismissDelayer(result));
    for (int i = 0; i < root.getChildCount(); i++) {
        result
            .expandPath(new TreePath(((DefaultMutableTreeNode) root.getChildAt(i)).getPath()));
    }
    result.setBackground(null);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:43,代码来源:ControlDisplay.java

示例9: setupGUI

import javax.swing.JTree; //导入方法依赖的package包/类
private void setupGUI()
{
	JButton addButton = new JButton(addAction);
	JButton removeButton = new JButton(removeAction);
	JButton addGrouping = new JButton(addGroupingAction);

	finder = new TabbedFinder(userService, filters);
	finder.setSingleSelectionOnly(false);
	finder.addFinderListener(this);

	model = new ExpressionBuilderModel();

	tree = new JTree(model)
	{
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isPathEditable(TreePath path)
		{
			return ((ExpressionTreeNode) path.getLastPathComponent()).isGrouping();
		}
	};
	tree.setEditable(true);
	tree.addTreeSelectionListener(this);
	tree.setExpandsSelectedPaths(true);
	tree.setShowsRootHandles(true);
	tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);

	ExpressionTreeCellRenderer cellRenderer = new ExpressionTreeCellRenderer(userService);

	JComboBox<Grouping> editorCombo = new JComboBox<Grouping>();
	editorCombo.addItem(Grouping.MATCH_ANY);
	editorCombo.addItem(Grouping.MATCH_ALL);
	editorCombo.addItem(Grouping.MATCH_NONE);

	DefaultTreeCellEditor cellEditor = new DefaultTreeCellEditor(tree, cellRenderer, new DefaultCellEditor(
		editorCombo));

	tree.setCellRenderer(cellRenderer);
	tree.setCellEditor(cellEditor);

	JScrollPane treeScroller = new JScrollPane(tree);

	setLayout(new MigLayout("fill", // layout constraints
		"[grow 2, fill][][250]", // cols
		"[grow][]10[][grow][]")); // rows

	add(finder, "spany 5");
	add(treeScroller, "skip 1, spany 4, wmin 250px, grow, wrap");
	add(addButton, "wrap, wmax 45px");
	add(removeButton, "wrap, wmax 45px");
	add(addGrouping, "newline, skip 2, center");

	if( CurrentLocale.isRightToLeft() )
	{
		applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
		addButton.setText("<");
		removeButton.setText(">");
	}

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:63,代码来源:ExpressionBuilderFinder.java


注:本文中的javax.swing.JTree.setShowsRootHandles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。