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


Java DefaultTreeSelectionModel.setSelectionMode方法代码示例

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


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

示例1: buildTree

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的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: OntologyBrowser

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的package包/类
public OntologyBrowser(OWLOntology ontology, Set<String> rootsToRemove) {
  super();
  this.ontology = ontology;
  this.rootConcept = "Thing";
  this.buildTreeModel();
  for (String concept : rootsToRemove) {
    DefaultMutableTreeNode node = getNodeFromName(concept);
    this.dtm.removeNodeFromParent(node);
  }

  this.setModel(this.dtm);
  // set the tree selection model
  DefaultTreeSelectionModel dtsm = new DefaultTreeSelectionModel();
  dtsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  this.setSelectionModel(dtsm);
  // set the tree renderer
  OntologyRenderer myRenderer = new OntologyRenderer();
  this.setCellRenderer(myRenderer);
  this.setRootVisible(false);
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:21,代码来源:OntologyBrowser.java

示例3: PullRequestsTreeModel

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的package包/类
public PullRequestsTreeModel() {
    super(null);

    this.root = new PRTreeNode(TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_TITLE));
    setRoot(root);
    this.requestedByMeRoot = new PRTreeNode(TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REQUESTED_BY_ME));
    root.insert(requestedByMeRoot, 0);
    this.assignedToMeRoot = new PRTreeNode(TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_ASSIGNED_TO_ME));
    root.insert(assignedToMeRoot, 1);

    allRequestedByMePullRequests = new ArrayList<GitPullRequest>();
    allAssignedToMePullRequests = new ArrayList<GitPullRequest>();

    selectionModel = new DefaultTreeSelectionModel();
    selectionModel.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:17,代码来源:PullRequestsTreeModel.java

示例4: init

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的package包/类
private void init() {
    editor = new ProcessEditor();
    editor.setModel(form);
    editor.setAnimationEnabled(true);
    editorPane.setLayout(new GridLayout(1,1));
    editorPane.add(editor);
    transferHandler = new XFormsWizardTransferHandler(editor);
    editor.setTransferHandler(transferHandler);
    XFormsWizardTreeCellRenderer cr = new XFormsWizardTreeCellRenderer();
    boTree.setCellRenderer(cr);
    boTree.setDragEnabled(true);
    boTree.setTransferHandler(transferHandler);
    DefaultTreeSelectionModel selModel = new DefaultTreeSelectionModel();
    selModel.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
    boTree.setSelectionModel(selModel);
    actionTree.setCellRenderer(cr);
    actionTree.setDragEnabled(true);
    actionTree.setTransferHandler(transferHandler);
    actionTree.setRootVisible(false);
}
 
开发者ID:frapu78,项目名称:processeditor,代码行数:21,代码来源:XFormsWizard.java

示例5: CTagsTree

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的package包/类
/**
 * Creates a new tree object.
 *
 * @param parent Parent window used for dialogs.
 * @param graph Graph shown in the window.
 * @param manager Provides tag information.
 */
public CTagsTree(final JFrame parent, final ZyGraph graph, final ITagManager manager) {
  m_parent = Preconditions.checkNotNull(parent, "IE02308: Perent argument can not be null");
  m_graph = Preconditions.checkNotNull(graph, "IE01776: Graph can not be null");
  m_tagManager = Preconditions.checkNotNull(manager, "IE01777: Manager argument can not be null");

  m_model = new CTagsTreeModel(this);
  setModel(m_model);
  getModel().addTreeModelListener(new InternalModelListener());
  addMouseListener(m_mouseListener);
  m_graph.addListener(m_graphSelectionListener);
  m_graph.addListener(m_graphVisibilityListener);

  setRootVisible(false);

  m_rootNode = new CRootTagTreeNode(parent, this, graph, m_tagManager);
  m_model.setRoot(m_rootNode);

  setCellRenderer(new CTagTreeCellRenderer()); // ATTENTION: UNDER NO CIRCUMSTANCES MOVE THIS LINE
                                               // ABOVE THE SETROOT LINE

  m_model.nodeStructureChanged(m_rootNode);

  final List<IDropHandler> handlers = new ArrayList<IDropHandler>();

  handlers.add(new CTagSortingHandler());

  new CDefaultTransferHandler(this, DnDConstants.ACTION_COPY_OR_MOVE, handlers);

  final DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
  selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  setSelectionModel(selectionModel);

  final InputMap windowImap = getInputMap(JComponent.WHEN_FOCUSED);

  windowImap.put(HotKeys.DELETE_HK.getKeyStroke(), "DELETE");
  getActionMap().put("DELETE", CActionProxy.proxy(new DeleteAction()));
}
 
开发者ID:google,项目名称:binnavi,代码行数:45,代码来源:CTagsTree.java

示例6: TypesTree

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的package包/类
public TypesTree() {
  setRootVisible(false);
  setDragEnabled(true);
  setDropMode(DropMode.INSERT); // Dropped objects are inserted behind the drop location.
  setToggleClickCount(1); // Child nodes expand with a single click.
  final DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
  selectionModel.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  setSelectionModel(selectionModel);
  final IconNodeRenderer renderer = new IconNodeRenderer();
  renderer.setFont(GuiHelper.MONOSPACED_FONT);
  setCellRenderer(renderer);
}
 
开发者ID:google,项目名称:binnavi,代码行数:13,代码来源:TypesTree.java

示例7: AttributePanel

import javax.swing.tree.DefaultTreeSelectionModel; //导入方法依赖的package包/类
public AttributePanel(Provider prv, int visibleRows) {
	provider = prv;
	try {
		attributes = provider.getAttributes();
	} catch (Exception pe) {
		pe.printStackTrace();
	}
	setLayout(new GridLayout(1, 1));
	// Init tree node and model (attribute tree nodes)
	root = new AttributeRootNode();
	model = new DefaultTreeModel(root);

	// Init tree view
	tree = new JTree(model);
	if (visibleRows != 0)
		tree.setVisibleRowCount(visibleRows);
	tree.putClientProperty("JTree.lineStyle", "Angled");
	tree.setRootVisible(false);
	tree.setShowsRootHandles(true);
	smodel = new DefaultTreeSelectionModel();
	smodel
			.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
	smodel
			.addTreeSelectionListener(slistener = new AttributeSelectionListener());
	tree.setSelectionModel(smodel);
	tree.setCellRenderer(new AttributeCellRenderer());
	tree.addMouseListener(new AttributePopup());

	scrollPane = new JScrollPane(tree);
	scrollPane.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
	add(scrollPane, BorderLayout.CENTER);

	// validate components
	tree.validate();
	scrollPane.validate();
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:37,代码来源:AttributePanel.java


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