javax.swing.JTree.setExpandsSelectedPaths()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中javax.swing.JTree.setExpandsSelectedPaths()方法的一些代码示例,展示了JTree.setExpandsSelectedPaths()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.setExpandsSelectedPaths()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:setExpandsSelectedPaths

JTree.setExpandsSelectedPaths介绍

暂无

代码示例

代码示例来源:origin: org.zaproxy/zap

public void showInSites (SiteNode node) {
  TreeNode[] path = node.getPath();
  TreePath tp = new TreePath(path);
  treeSite.setExpandsSelectedPaths(true);
  treeSite.setSelectionPath(tp);
  treeSite.scrollPathToVisible(tp);
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
protected void loadPage(JEditorPane pane, HyperlinkEvent evt)
{
  try
  {
    String diretorioTopico = evt.getURL().getPath();
    Topico topico = ajuda.obterTopicoPeloDiretorio(diretorioTopico.substring(diretorioTopico.lastIndexOf("topicos")));
    TreePath caminhoTopicoNaArvore = localizarTopicoNaArvore((DefaultMutableTreeNode) arvore.getModel().getRoot(), topico);
    if (caminhoTopicoNaArvore != null)
    {
      arvore.setExpandsSelectedPaths(true);
      arvore.setSelectionPath(caminhoTopicoNaArvore);
    }
  } catch (ErroCaminhoTopicoInvalido | ErroTopicoNaoEncontrado ex)
  {
    Logger.getLogger(AbaAjuda.class.getName()).log(Level.SEVERE, null, ex);
  }
}

代码示例来源:origin: igvteam/igv

private void initTree(DefaultMutableTreeNode rootNode) {
  tree = new JTree(rootNode);
  tree.setExpandsSelectedPaths(true);
  tree.setCellRenderer(new NodeRenderer());
  tree.setCellEditor(new ResourceEditor(tree));
  tree.setEditable(true);
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public Component createPageComponent() {
  JPanel panel = new JPanel(new BorderLayout(4, 4));
  panel.setBorder(new EmptyBorder(4, 4, 4, 4));
  panel.add(new JLabel("Available layers:"), BorderLayout.NORTH);
  LayerSourcePageContext context = getContext();
  modelCRS = (CoordinateReferenceSystem) context.getLayerContext().getCoordinateReferenceSystem();
  WMSCapabilities wmsCapabilities = (WMSCapabilities) context.getPropertyValue(
      WmsLayerSource.PROPERTY_NAME_WMS_CAPABILITIES);
  layerTree = new JTree(new WmsTreeModel(wmsCapabilities.getLayer()));
  layerTree.setRootVisible(false);
  layerTree.setShowsRootHandles(true);
  layerTree.setExpandsSelectedPaths(true);
  layerTree.setCellRenderer(new MyDefaultTreeCellRenderer());
  layerTree.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  layerTree.getSelectionModel().addTreeSelectionListener(new LayerTreeSelectionListener());
  panel.add(new JScrollPane(layerTree), BorderLayout.CENTER);
  infoLabel = new JLabel(" ");
  panel.add(infoLabel, BorderLayout.SOUTH);
  getContext().setPropertyValue(WmsLayerSource.PROPERTY_NAME_SELECTED_LAYER, null);
  return panel;
}

代码示例来源:origin: bcdev/beam

@Override
public Component createPageComponent() {
  JPanel panel = new JPanel(new BorderLayout(4, 4));
  panel.setBorder(new EmptyBorder(4, 4, 4, 4));
  panel.add(new JLabel("Available layers:"), BorderLayout.NORTH);
  LayerSourcePageContext context = getContext();
  modelCRS = (CoordinateReferenceSystem) context.getLayerContext().getCoordinateReferenceSystem();
  WMSCapabilities wmsCapabilities = (WMSCapabilities) context.getPropertyValue(
      WmsLayerSource.PROPERTY_NAME_WMS_CAPABILITIES);
  layerTree = new JTree(new WmsTreeModel(wmsCapabilities.getLayer()));
  layerTree.setRootVisible(false);
  layerTree.setShowsRootHandles(true);
  layerTree.setExpandsSelectedPaths(true);
  layerTree.setCellRenderer(new MyDefaultTreeCellRenderer());
  layerTree.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  layerTree.getSelectionModel().addTreeSelectionListener(new LayerTreeSelectionListener());
  panel.add(new JScrollPane(layerTree), BorderLayout.CENTER);
  infoLabel = new JLabel(" ");
  panel.add(infoLabel, BorderLayout.SOUTH);
  getContext().setPropertyValue(WmsLayerSource.PROPERTY_NAME_SELECTED_LAYER, null);
  return panel;
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

/**
 * Creation d'une vue pour le modele.
 */
public JTree createView(final boolean _onlyGeomSelected, final boolean _multiSelection) {
 final JTree tree = new JTree(this);
 tree.setEditable(false);
 tree.setShowsRootHandles(true);
 tree.setExpandsSelectedPaths(true);
 tree.setCellRenderer(new CellRenderer(_onlyGeomSelected));
 tree.setRootVisible(false);
 tree.setFocusable(true);
 if (_onlyGeomSelected) {
  final TreeSelectionModel onlyGeomSelectionModel = new OnlyGeomTreeSelectionModel();
  tree.setSelectionModel(onlyGeomSelectionModel);
 }
 
 if (_multiSelection)
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
 else 
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 return tree;
}

代码示例来源:origin: org.qi4j.tool/org.qi4j.tool.envisage

structureTree.setRootVisible( false );
structureTree.setShowsRootHandles( true );
structureTree.setExpandsSelectedPaths( true );
structureTree.setScrollsOnExpand( true );
structureTree.setName( STRUCTURE_VIEW );
typeTree.setRootVisible( false );
typeTree.setShowsRootHandles( true );
typeTree.setExpandsSelectedPaths( true );
typeTree.setScrollsOnExpand( true );
typeTree.setName( TYPE_VIEW );

代码示例来源:origin: dsukhoroslov/bagri

docTree.setExpandsSelectedPaths(true);
docTree.setShowsRootHandles(true);
docTree.setRootVisible(false);

代码示例来源:origin: net.sf.taverna.t2.ui-components/results-view

tree = new JTree(filteredTreeModel);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setExpandsSelectedPaths(true);
tree.setRootVisible(false);
tree.setShowsRootHandles(true);

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

public static JTree createCalqueTree(final CalqueFindCourbeTreeModel _treeModel, final boolean _onlyCourbeSelected) {
 final JTree tree = new JTree(_treeModel.getTreeModel());
 tree.setEditable(false);
 tree.setShowsRootHandles(true);
 tree.setExpandsSelectedPaths(true);
 tree.setCellRenderer(createRenderer(_onlyCourbeSelected));
 tree.setRootVisible(false);
 tree.setFocusable(true);
 if (_onlyCourbeSelected) {
  final TreeSelectionModel onlyCourbeSelectionModel = getOnlyCourbeSelectionModel();
  onlyCourbeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.setSelectionModel(onlyCourbeSelectionModel);
 }
 return tree;
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

tree.setExpandsSelectedPaths(true);
tree.setShowsRootHandles(true);
tree.setScrollsOnExpand(true);

代码示例来源:origin: nroduit/Weasis

tree.setShowsRootHandles(true);
tree.setRootVisible(false);
tree.setExpandsSelectedPaths(true);
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
renderer.setOpenIcon(null);

代码示例来源:origin: org.icepdf.os/icepdf-viewer

signatureTree = new SignaturesTree(treeModel);
signatureTree.setRootVisible(false);
signatureTree.setExpandsSelectedPaths(true);
signatureTree.setShowsRootHandles(true);
signatureTree.setScrollsOnExpand(true);

代码示例来源:origin: GoldenGnu/jeveassets

jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
jTree.putClientProperty("JTree.lineStyle", "None");
jTree.setExpandsSelectedPaths(true);
jTree.setRootVisible(false);
jTree.setShowsRootHandles(true);

代码示例来源:origin: mucommander/mucommander

tree.setExpandsSelectedPaths(true);
tree.getModel().addTreeModelListener(this);

代码示例来源:origin: org.icepdf.os/icepdf-viewer

commentTree = new JTree(root);
commentTree.setRootVisible(true);
commentTree.setExpandsSelectedPaths(true);
commentTree.setShowsRootHandles(true);
commentTree.setScrollsOnExpand(true);

代码示例来源:origin: net.sf.taverna.t2.workbench.views/results

tree.setExpandsSelectedPaths(true);
tree.setLargeModel(true);
tree.setRootVisible(false);

代码示例来源:origin: org.zaproxy/zap

public SiteNode showDialog(SiteNode defaultNode) {
  // Assume Contexts cant be selected
  this.getTreeContext().setVisible(false);
  SiteNode siteRoot = (SiteNode)Model.getSingleton().getSession().getSiteTree().getRoot();
  populateNode(siteRoot, (SiteNode)this.siteTree.getRoot(), defaultNode);
  if (selectedSiteNode != null) {
    // Found the default node, select it
    TreePath path = new TreePath(this.siteTree.getPathToRoot(selectedSiteNode));
    this.getTreeSite().setExpandsSelectedPaths(true);
    this.getTreeSite().setSelectionPath(path);
    this.getTreeSite().scrollPathToVisible(path);
    this.getTreeSite().expandPath(path);
  } else {
    // no default path, just expand the top level
    TreePath path = new TreePath(this.siteTree.getPathToRoot((TreeNode)this.siteTree.getRoot()));
    this.getTreeSite().expandPath(path);
  }
  this.setVisible(true);
  // The dialog is modal so this wont return until the dialog visibility is unset
  return selectedSiteNode;
}

代码示例来源:origin: org.zaproxy/zap

public Target showDialog(Target defaultTarget) {
  // Assume Contexts can be selected
  this.getTreeContext().setVisible(true);
  SiteNode siteRoot = (SiteNode)Model.getSingleton().getSession().getSiteTree().getRoot();
  populateContexts((SiteNode)this.contextTree.getRoot());
  if (defaultTarget != null) {
    populateNode(siteRoot, (SiteNode)this.siteTree.getRoot(), defaultTarget.getStartNode());
  } else { 
    populateNode(siteRoot, (SiteNode)this.siteTree.getRoot(), null);
  }
  if (selectedSiteNode != null) {
    // Found the default node, select it
    TreePath path = new TreePath(this.siteTree.getPathToRoot(selectedSiteNode));
    this.getTreeSite().setExpandsSelectedPaths(true);
    this.getTreeSite().setSelectionPath(path);
    this.getTreeSite().scrollPathToVisible(path);
    this.getTreeSite().expandPath(path);
  } else {
    // no default path, just expand the top level
    TreePath path = new TreePath(this.siteTree.getPathToRoot((TreeNode)this.siteTree.getRoot()));
    this.getTreeSite().expandPath(path);
  }
  this.setVisible(true);
  // The dialog is modal so this wont return until the dialog visibility is unset
  if (selectedSiteNode != null) {
    return new Target(selectedSiteNode);
  }
  return selectedTarget;
}

代码示例来源:origin: org.xworker/xworker_core

comp.setExpandsSelectedPaths(expandsSelectedPaths);

相关文章

JTree类方法