当前位置: 首页>>代码示例>>Java>>正文


Java TreeCellEditor类代码示例

本文整理汇总了Java中javax.swing.tree.TreeCellEditor的典型用法代码示例。如果您正苦于以下问题:Java TreeCellEditor类的具体用法?Java TreeCellEditor怎么用?Java TreeCellEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeCellEditor类属于javax.swing.tree包,在下文中一共展示了TreeCellEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: synchronizeRootContext

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/** Synchronize the root context from the manager of this Explorer.
*/
final void synchronizeRootContext() {
    // #151850 cancel editing before changing root node
    Mutex.EVENT.readAccess(new Runnable() {
        @Override
        public void run() {
            TreeCellEditor cellEditor = tree.getCellEditor();
            if (cellEditor instanceof TreeViewCellEditor) {
                ((TreeViewCellEditor) cellEditor).abortTimer();
            }
            tree.cancelEditing();
            final Node rc = manager.getRootContext();
            LOG.log(Level.FINE, "synchronizeRootContext {0}", rc);
            treeModel.setNode(rc, visHolder);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TreeView.java

示例2: uninstallListeners

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * Uninstall all registered listeners
 */
protected void uninstallListeners()
{
  tree.removePropertyChangeListener(propertyChangeListener);
  tree.removeFocusListener(focusListener);
  tree.removeTreeSelectionListener(treeSelectionListener);
  tree.removeMouseListener(mouseListener);
  tree.removeKeyListener(keyListener);
  tree.removePropertyChangeListener(selectionModelPropertyChangeListener);
  tree.removeComponentListener(componentListener);
  tree.removeTreeExpansionListener(treeExpansionListener);

  TreeCellEditor tce = tree.getCellEditor();
  if (tce != null)
    tce.removeCellEditorListener(cellEditorListener);
  if (treeModel != null)
    treeModel.removeTreeModelListener(treeModelListener);
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:BasicTreeUI.java

示例3: propertyChange

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
public void propertyChange(final PropertyChangeEvent e) {
    String changedProperty = e.getPropertyName();
    if (JTree.CELL_RENDERER_PROPERTY.equals(changedProperty)) {
        setCellRenderer((TreeCellRenderer)e.getNewValue());
    } else if (JTree.CELL_EDITOR_PROPERTY.equals(changedProperty)) {
        setCellEditor((TreeCellEditor)e.getNewValue());
    } else if (JTree.TREE_MODEL_PROPERTY.equals(changedProperty)) {
        setModel((TreeModel)e.getNewValue());
    } else if (JTree.ROOT_VISIBLE_PROPERTY.equals(changedProperty)) {
        setRootVisible(((Boolean)e.getNewValue()).booleanValue());
    } else if (JTree.SHOWS_ROOT_HANDLES_PROPERTY.equals(changedProperty)) {
        setShowsRootHandles(((Boolean)e.getNewValue()).booleanValue());
    } else if (JTree.ROW_HEIGHT_PROPERTY.equals(changedProperty)) {
        setRowHeight(((Integer)e.getNewValue()).intValue());
    } else if (JTree.EDITABLE_PROPERTY.equals(changedProperty)) {
        setEditable(((Boolean)e.getNewValue()).booleanValue());
    } else if (JTree.LARGE_MODEL_PROPERTY.equals(changedProperty)) {
        setLargeModel(((Boolean)e.getNewValue()).booleanValue());
    } else if (JTree.SELECTION_MODEL_PROPERTY.equals(changedProperty)) {
        setSelectionModel((TreeSelectionModel)e.getNewValue());
    } else if (JTree.LEAD_SELECTION_PATH_PROPERTY.equals(changedProperty)) {
        TreePath leadPath = (TreePath)e.getNewValue();
        lastSelectedRow = leadPath != null ? tree.getRowForPath(leadPath) : -1;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:BasicTreeUI.java

示例4: createTreeCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * This is invoked if a TreeCellEditor is not supplied in the constructor.
 * It returns a TextField editor.
 */
@Override
protected TreeCellEditor createTreeCellEditor() {
    JTextField tf = new JTextField() {
            @Override
            public void addNotify() {
                stopped = cancelled = false;
                super.addNotify();
                requestFocus();
            }
        };
    //#137454 - text not visible in in-place editor
    String laf = UIManager.getLookAndFeel().getID();
    if( "GTK".equals( laf ) ) { //NOI18N
        tf.setBorder( BorderFactory.createEmptyBorder() );
    } else if( "Nimbus".equals( laf ) ) { //NOI18N
        tf.setBorder( BorderFactory.createLineBorder( new JTree().getBackground() ) );
    }
    tf.registerKeyboardAction( //TODO update to use inputMap/actionMap
        this, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true), JComponent.WHEN_FOCUSED);

    tf.addFocusListener(this);

    Ed ed = new Ed(tf);
    ed.setClickCountToStart(1);
    ed.getComponent().getAccessibleContext().setAccessibleDescription(
        NbBundle.getMessage(TreeViewCellEditor.class, "ACSD_TreeViewCellEditor")
    ); // NOI18N
    ed.getComponent().getAccessibleContext().setAccessibleName(
        NbBundle.getMessage(TreeViewCellEditor.class, "ACSN_TreeViewCellEditor")
    ); // NOI18N

    return ed;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:TreeViewCellEditor.java

示例5: createDefaultCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected TreeCellEditor createDefaultCellEditor() {
    TreeCellRenderer renderer = tree.getCellRenderer();
    DefaultTreeCellEditor editor;

    if(renderer != null && (renderer instanceof DefaultTreeCellRenderer)) {
        editor = new SynthTreeCellEditor(tree, (DefaultTreeCellRenderer)
                                         renderer);
    }
    else {
        editor = new SynthTreeCellEditor(tree, null);
    }
    return editor;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SynthTreeUI.java

示例6: createTreeCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
@Override
protected TreeCellEditor createTreeCellEditor() {
    JTextField tf = new JTextField() {
        @Override
        public String getName() {
            return "Tree.cellEditor";
        }
    };
    DefaultCellEditor editor = new DefaultCellEditor(tf);

    // One click to edit.
    editor.setClickCountToStart(1);
    return editor;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:SynthTreeUI.java

示例7: createTreeCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
@Override
protected TreeCellEditor createTreeCellEditor() {
    @SuppressWarnings("serial") // anonymous class
    JTextField tf = new JTextField() {
        @Override
        public String getName() {
            return "Tree.cellEditor";
        }
    };
    DefaultCellEditor editor = new DefaultCellEditor(tf);

    // One click to edit.
    editor.setClickCountToStart(1);
    return editor;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:SynthTreeUI.java

示例8: getCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * Maps {@code JTree.getCellEditor()} through queue
 */
public TreeCellEditor getCellEditor() {
    return (runMapping(new MapAction<TreeCellEditor>("getCellEditor") {
        @Override
        public TreeCellEditor map() {
            return ((JTree) getSource()).getCellEditor();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JTreeOperator.java

示例9: setCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * Maps {@code JTree.setCellEditor(TreeCellEditor)} through queue
 */
public void setCellEditor(final TreeCellEditor treeCellEditor) {
    runMapping(new MapVoidAction("setCellEditor") {
        @Override
        public void map() {
            ((JTree) getSource()).setCellEditor(treeCellEditor);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JTreeOperator.java

示例10: setCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
public void setCellEditor(TreeCellEditor editor)
{
  if (cellEditor == editor)
    return;

  TreeCellEditor oldValue = cellEditor;
  cellEditor = editor;
  firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
}
 
开发者ID:vilie,项目名称:javify,代码行数:10,代码来源:JTree.java

示例11: updateCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * Updates the cellEditor based on editability of the JTree that we're
 * contained in. If the tree is editable but doesn't have a cellEditor, a
 * basic one will be used.
 */
protected void updateCellEditor()
{
  completeEditing();
  TreeCellEditor newEd = null;
  if (tree != null && tree.isEditable())
    {
      newEd = tree.getCellEditor();
      if (newEd == null)
        {
          newEd = createDefaultCellEditor();
          if (newEd != null)
            {
              tree.setCellEditor(newEd);
              createdCellEditor = true;
            }
        }
    }
  // Update listeners.
  if (newEd != cellEditor)
    {
      if (cellEditor != null && cellEditorListener != null)
        cellEditor.removeCellEditorListener(cellEditorListener);
      cellEditor = newEd;
      if (cellEditorListener == null)
        cellEditorListener = createCellEditorListener();
      if (cellEditor != null && cellEditorListener != null)
        cellEditor.addCellEditorListener(cellEditorListener);
      createdCellEditor = false;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:36,代码来源:BasicTreeUI.java

示例12: getTreeCellEditorComponent

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
@Override
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) {
  final ErrorTreeElement element = getElement(value);
  if (element instanceof EditableMessageElement) {
    EditableMessageElement editableMessageElement = (EditableMessageElement)element;
    final CustomizeColoredTreeCellRenderer leftSelfRenderer = editableMessageElement.getLeftSelfRenderer();
    final TreeCellEditor rightSelfEditor = editableMessageElement.getRightSelfEditor();
    myColoredTreeCellRenderer.setCurrentCallback(leftSelfRenderer);
    myRightCellRenderer.setCurrentCallback(rightSelfEditor);
    return myWrapperEditor.getTreeCellEditorComponent(tree, value, selected, expanded, leaf, row);
  }
  return myTree.getCellRenderer().getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:NewErrorTreeEditor.java

示例13: getCellEditorAndText

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
@NotNull
private Pair<JEditorPane, String> getCellEditorAndText() {
  // There is no specific UI component for a hyperlink in the "Messages" window. Instead we have a JEditorPane with HTML. This method
  // finds the anchor tags, and matches the text of each of them against the given text. If a matching hyperlink is found, we fire a
  // HyperlinkEvent, simulating a click on the actual hyperlink.
  assertThat(myTarget).isInstanceOf(EditableNotificationMessageElement.class);

  final JEditorPane editorComponent = execute(new GuiQuery<JEditorPane>() {
    @Override
    protected JEditorPane executeInEDT() throws Throwable {
      EditableNotificationMessageElement message = (EditableNotificationMessageElement)myTarget;
      TreeCellEditor cellEditor = message.getRightSelfEditor();
      return field("editorComponent").ofType(JEditorPane.class).in(cellEditor).get();
    }
  });
  assertNotNull(editorComponent);

  String text = execute(new GuiQuery<String>() {
    @Override
    protected String executeInEDT() throws Throwable {
      return editorComponent.getText();
    }
  });
  assertNotNull(text);

  return Pair.create(editorComponent, text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:MessagesToolWindowFixture.java

示例14: createDefaultCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
protected TreeCellEditor createDefaultCellEditor() {
    TreeCellRenderer renderer = tree.getCellRenderer();
    DefaultTreeCellEditor editor;

    if (renderer != null && (renderer instanceof DefaultTreeCellRenderer)) {
        editor = new SynthTreeCellEditor(tree, (DefaultTreeCellRenderer) renderer);
    } else {
        editor = new SynthTreeCellEditor(tree, null);
    }
    return editor;
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:16,代码来源:SeaGlassTreeUI.java

示例15: createDefaultCellEditor

import javax.swing.tree.TreeCellEditor; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
protected TreeCellEditor createDefaultCellEditor() {
    TreeCellRenderer renderer = tree.getCellRenderer();
    DefaultTreeCellEditor editor;

    if(renderer != null && (renderer instanceof DefaultTreeCellRenderer)) {
        editor = new SynthTreeCellEditor(tree, (DefaultTreeCellRenderer)
                                         renderer);
    }
    else {
        editor = new SynthTreeCellEditor(tree, null);
    }
    return editor;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:18,代码来源:SynthTreeUI.java


注:本文中的javax.swing.tree.TreeCellEditor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。