當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。