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

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

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

JTree.setFocusable介绍

暂无

代码示例

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
 public void run() {
  lastSelectionDateTime = Dates.nowUtc();
  sidebarTree.setFocusable(true);
  sidebarTree.requestFocusInWindow();
 }
});

代码示例来源:origin: sarahtattersall/PIPE

public JTree getModuleTree() {
  Collection<Class<? extends GuiModule>> classes = new ArrayList<>();
  // get the names of all the classes that are confirmed to be modules
  Collection<Class<? extends GuiModule>> names = getModuleClasses();
  classes.addAll(names);
  // create the root node
  DefaultMutableTreeNode root = new DefaultMutableTreeNode("Analysis Module Manager");
  // create root children
  loadModules = new DefaultMutableTreeNode("Available Modules");
  MutableTreeNode add_modules = new DefaultMutableTreeNode(LOAD_NODE_STRING);
  // iterate over the class names and create a node for each
  for (Class<? extends GuiModule> clazz : classes) {
    // create each ModuleClass node using an instantiation of the
    // ModuleClass
    addClassToTree(clazz);
  }
  root.add(loadModules);
  root.add(add_modules);
  treeModel = new DefaultTreeModel(root);
  moduleTree = new JTree(treeModel);
  moduleTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  moduleTree.addMouseListener(new TreeHandler());
  moduleTree.setFocusable(false);
  // expand the modules path
  moduleTree.expandPath(moduleTree.getPathForRow(1));
  return moduleTree;
}

代码示例来源: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.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: de.lmu.ifi.dbs.elki/elki

/**
 * Creates the JList used in the popup to display the items in the combo box
 * model. This method is called when the UI class is created.
 * 
 * @return a <code>JList</code> used to display the combo box items
 */
protected JTree createTree() {
 JTree tree = new JTree(model);
 tree.setName("TreePopup.tree");
 tree.setFont(getFont());
 tree.setForeground(getForeground());
 tree.setBackground(getBackground());
 tree.setBorder(null);
 tree.setFocusable(true);
 tree.addMouseListener(handler);
 tree.addKeyListener(handler);
 tree.setCellRenderer(new Renderer());
 return tree;
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-gui-minigui

/**
 * Creates the JList used in the popup to display the items in the combo box
 * model. This method is called when the UI class is created.
 * 
 * @return a <code>JList</code> used to display the combo box items
 */
protected JTree createTree() {
 JTree tree = new JTree(model);
 tree.setName("TreePopup.tree");
 tree.setFont(getFont());
 tree.setForeground(getForeground());
 tree.setBackground(getBackground());
 tree.setBorder(null);
 tree.setFocusable(true);
 tree.addMouseListener(handler);
 tree.addKeyListener(handler);
 tree.setCellRenderer(new Renderer());
 return tree;
}

代码示例来源:origin: elki-project/elki

/**
 * Creates the JList used in the popup to display the items in the combo box
 * model. This method is called when the UI class is created.
 * 
 * @return a <code>JList</code> used to display the combo box items
 */
protected JTree createTree() {
 JTree tree = new JTree(model);
 tree.setName("TreePopup.tree");
 tree.setFont(getFont());
 tree.setForeground(getForeground());
 tree.setBackground(getBackground());
 tree.setBorder(null);
 tree.setFocusable(true);
 tree.addMouseListener(handler);
 tree.addKeyListener(handler);
 tree.setCellRenderer(new Renderer());
 return tree;
}

代码示例来源:origin: org.gephi/directory-chooser

tree.setFocusable(true);
tree.setOpaque(true);
tree.setRootVisible(false);

代码示例来源:origin: org.biojava.thirdparty/forester

_tree = new JTree( top );
getJTree().setEditable( true );
getJTree().setFocusable( true );
getJTree().setToggleClickCount( 1 );
getJTree().setInvokesStopCellEditing( true );

相关文章

JTree类方法