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

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

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

JTree.setCellEditor介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

代码示例来源:origin: pentaho/mondrian

tree.setCellEditor(editor);
tree.setEditable(true);

代码示例来源:origin: ron190/jsql-injection

this.tree.setCellEditor(new CellEditorNode());

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

JTree tree = new JTree();
tree.setEditable(true);
TreeCellEditor editor = 
    new DefaultTreeCellEditor(tree, (DefaultTreeCellRenderer) tree.getCellRenderer()) {
  @Override
  protected boolean canEditImmediately(EventObject event) {
    if((event instanceof MouseEvent) &&
      SwingUtilities.isLeftMouseButton((MouseEvent)event)) {
      MouseEvent       me = (MouseEvent)event;

      return ((me.getClickCount() >= 1) &&
          inHitRegion(me.getX(), me.getY()));
    }
    return (event == null);
  }
};
tree.setCellEditor(editor);

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

JTree t = new JTree();
 t.setEditable(true);
 TreeCellRenderer cellRenderer = t.getCellRenderer();
 DefaultTreeCellEditor cellEditor = new DefaultTreeCellEditor(t, (DefaultTreeCellRenderer) cellRenderer){
   @Override
   public boolean isCellEditable(EventObject arg0) {
     if(arg0 instanceof MouseEvent){
       return ((MouseEvent)arg0).getClickCount() > 2;
     }
     return super.isCellEditable(arg0);
   }
 };
 t.setCellEditor(cellEditor);

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

import java.awt.BorderLayout;
  import java.util.Properties;
  import javax.swing.*;
  import javax.swing.tree.TreeCellEditor;

  public class TreeEditJComboBox {

    public static void main(String args[]) {
      JFrame frame = new JFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      Properties props = System.getProperties();
      JTree tree = new JTree(props);

      JComboBox comboBox = new JComboBox(new String[]{"A", "B", "C"});
      TreeCellEditor editor = new DefaultCellEditor(comboBox);

      tree.setEditable(true);
      tree.setCellEditor(editor);

      JScrollPane scrollPane = new JScrollPane(tree);
      frame.add(scrollPane, BorderLayout.CENTER);
      frame.setSize(300, 150);
      frame.setVisible(true);
    }

  }
}

代码示例来源: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: net.sf.jt400/jt400

tree_.setCellEditor (new VObjectCellEditor ());
tree_.setCellRenderer (new VObjectCellRenderer ());
tree_.setEditable (true);

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

public static void createCellEditor(ActionContext actionContext){
  Thing self = (Thing) actionContext.get("self");
  JTree parent = (JTree) actionContext.get("parent");
  
  for(Thing child : self.getChilds()){
    TreeCellEditor obj = (TreeCellEditor) child.doAction("create", actionContext);
    if(obj != null){
      parent.setCellEditor(obj);
      break;
    }
  }
}

代码示例来源:origin: robward-scisys/sldeditor

new ComponentCellRenderer(symbolTree.getCellRenderer());
symbolTree.setCellRenderer(cellRenderer);
symbolTree.setCellEditor(new CheckBoxNodeEditor(symbolTree, cellRenderer, this));
symbolTree.setEditable(true);
symbolTree.setRowHeight(0);

代码示例来源:origin: org.apache/log4j

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

代码示例来源:origin: apache-log4j/log4j

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

代码示例来源:origin: atarw/material-ui-swing

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JTree tree = (JTree) c;
  DefaultTreeCellRenderer renderer = new MaterialTreeCellRenderer ();
  TreeCellEditor editor = new MaterialTreeCellEditor (tree, renderer);
  tree.setCellRenderer (renderer);
  tree.setCellEditor (editor);
  tree.setFont (UIManager.getFont ("Tree.font"));
  tree.setRowHeight (0);
  tree.setInvokesStopCellEditing (true);
  MaterialTreeUI ui = (MaterialTreeUI) tree.getUI ();
  ui.setLeftChildIndent (10);
  ui.setRightChildIndent (10);
}

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

/**
 * Create the Toc JTree
 *
 * @return the Toc JTree
 */
private JTree makeTree() {
    tree = new JTree();
    //Items can be selected freely
    tree.getSelectionModel().setSelectionMode(
        TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    TocTransferHandler handler = new TocTransferHandler(this);
    //Add a drop listener
    handler.getTransferEditableEvent().addListener(this,
        EventHandler.create(EditableTransferListener.class, this, "onDropEditableElement", ""));
    tree.setDragEnabled(true);
    tree.setTransferHandler(handler);
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    tree.setEditable(true);
    treeRenderer = new TocRenderer(tree);
    tree.setCellRenderer(treeRenderer);
    setEmptyLayerModel(tree);
    tree.setCellEditor(new TocTreeEditor(tree));
    tree.addMouseListener(new PopupMouselistener());
    //Add a tree selection listener
    tree.getSelectionModel().addTreeSelectionListener(
        EventHandler.create(TreeSelectionListener.class, this, "onTreeSelectionChange"));
    return tree;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

tree.setCellEditor(new TreeViewCellEditor(tree));
tree.setEditable(true);
tree.setInvokesStopCellEditing(true);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

tree.setCellEditor(new TreeViewCellEditor(tree));
tree.setEditable(true);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

tree.setCellEditor(new TreeViewCellEditor(tree));
tree.setEditable(true);

相关文章

JTree类方法