當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。