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

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

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

JTree.startEditingAtPath介绍

暂无

代码示例

代码示例来源:origin: de.schlichtherle.truezip/truezip-file

@Override
public void startEditingAtPath(TreePath path) {
  editedNode = (TFile) path.getLastPathComponent();
  super.startEditingAtPath(path);
}

代码示例来源:origin: org.orbisgis/orbisgis-view

/**
 * The user select the menu rename
 */
public void onRenameItem() {
    TreePath[] paths = getSelectionPaths();
    if(paths!=null && paths.length==1) {
        super.startEditingAtPath(paths[0]);
    }
    
}
/**

代码示例来源:origin: org.orbisgis/toc

/**
 * Start editing the name of the currently selected element.
 *
 * @param evt The initial event.
 */
public final void renameElement(ActionEvent evt) {
  TreePath tp = tree.getSelectionPath();
  tree.startEditingAtPath(tp);
}

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

/**
 * The user select the menu rename
 */
public void onRenameItem() {
    TreePath[] paths = getSelectionPaths();
    if(paths!=null && paths.length==1) {
        super.startEditingAtPath(paths[0]);
    }
    
}
/**

代码示例来源:origin: stackoverflow.com

final JTree tree = new JTree();
tree.setEditable(true);
MouseListener ml = new MouseAdapter() {
  @Override
  public void mousePressed(MouseEvent e) {
    int row = tree.getRowForLocation(e.getX(), e.getY());
    TreePath path = tree.getPathForLocation(e.getX(), e.getY());
    if (row != -1) {
      if (e.getClickCount() == 1) {
        tree.startEditingAtPath(path);
      }
    }
  }
};
tree.addMouseListener(ml);
tree.getInputMap().put(
  KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "startEditing");

代码示例来源:origin: net.sf.jt400/jt400

public CellEditor startEditing (VObject object, Object propertyIdentifier)
  {
    // Validate the parameters.
    if (object == null)
      throw new NullPointerException ("object");
    if (propertyIdentifier == null)
      throw new NullPointerException ("propertyIdentifier");
    if (allowActions_ == false)
      return null;
    // Edit.
    //@B0A - Swing 1.1 bug. JTree.startEditingAtPath() will cause
    // a NullPointerException when it calls getPathBounds()
    // internally when the node isn't in the tree.
    if (tree_.getPathBounds(model_.getPath(object)) != null) //@B0A
    {                                                        //@B0A
     tree_.startEditingAtPath (model_.getPath (object));    //@B0A
    }                                                        //@B0A
    return tree_.getCellEditor ();
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc} <p>
 * Overridden to fix focus issues with editors. 
 * This method installs and updates the internal CellEditorRemover which
 * terminates ongoing edits if appropriate. Additionally, it
 * registers a CellEditorListener with the cell editor to grab the 
 * focus back to tree, if appropriate.
 * 
 * @see #updateEditorRemover()
 */
@Override
public void startEditingAtPath(TreePath path) {
  super.startEditingAtPath(path);
  if (isEditing()) {
    updateEditorListener();
    updateEditorRemover();
  }
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * {@inheritDoc} <p>
 * Overridden to fix focus issues with editors. 
 * This method installs and updates the internal CellEditorRemover which
 * terminates ongoing edits if appropriate. Additionally, it
 * registers a CellEditorListener with the cell editor to grab the 
 * focus back to tree, if appropriate.
 * 
 * @see #updateEditorRemover()
 */
@Override
public void startEditingAtPath(TreePath path) {
  super.startEditingAtPath(path);
  if (isEditing()) {
    updateEditorListener();
    updateEditorRemover();
  }
}

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

private void applyEdit(DirectoryNode node) {
  TreeNode[] nodes = model.getPathToRoot(node);
  TreePath editingPath = new TreePath(nodes);
  tree.setEditable(true);
  tree.makeVisible(editingPath);
  tree.scrollPathToVisible(editingPath);
  tree.setSelectionPath(editingPath);
  tree.startEditingAtPath(editingPath);
  
  JTextField editField = DirectoryCellEditor.getTextField();
  editField.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
  editField.setRequestFocusEnabled(true);
  editField.requestFocus();
  editField.setSelectionStart(0);
  editField.setSelectionEnd(editField.getText().length());
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc} <p>
 * Overridden to fix focus issues with editors. 
 * This method installs and updates the internal CellEditorRemover which
 * terminates ongoing edits if appropriate. Additionally, it
 * registers a CellEditorListener with the cell editor to grab the 
 * focus back to tree, if appropriate.
 * 
 * @see #updateEditorRemover()
 */
@Override
public void startEditingAtPath(TreePath path) {
  super.startEditingAtPath(path);
  if (isEditing()) {
    updateEditorListener();
    updateEditorRemover();
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc} <p>
 * Overridden to fix focus issues with editors. 
 * This method installs and updates the internal CellEditorRemover which
 * terminates ongoing edits if appropriate. Additionally, it
 * registers a CellEditorListener with the cell editor to grab the 
 * focus back to tree, if appropriate.
 * 
 * @see #updateEditorRemover()
 */
@Override
public void startEditingAtPath(TreePath path) {
  super.startEditingAtPath(path);
  if (isEditing()) {
    updateEditorListener();
    updateEditorRemover();
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc} <p>
 * Overridden to fix focus issues with editors. 
 * This method installs and updates the internal CellEditorRemover which
 * terminates ongoing edits if appropriate. Additionally, it
 * registers a CellEditorListener with the cell editor to grab the 
 * focus back to tree, if appropriate.
 * 
 * @see #updateEditorRemover()
 */
@Override
public void startEditingAtPath(TreePath path) {
  super.startEditingAtPath(path);
  if (isEditing()) {
    updateEditorListener();
    updateEditorRemover();
  }
}

代码示例来源:origin: stackoverflow.com

public void actionPerformed(ActionEvent e) {
  TreePath selectionPath = t.getSelectionPath();
  t.startEditingAtPath(selectionPath);

相关文章

JTree类方法