當前位置: 首頁>>代碼示例>>Java>>正文


Java MutableTreeNode.insert方法代碼示例

本文整理匯總了Java中javax.swing.tree.MutableTreeNode.insert方法的典型用法代碼示例。如果您正苦於以下問題:Java MutableTreeNode.insert方法的具體用法?Java MutableTreeNode.insert怎麽用?Java MutableTreeNode.insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.tree.MutableTreeNode的用法示例。


在下文中一共展示了MutableTreeNode.insert方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: moveUp

import javax.swing.tree.MutableTreeNode; //導入方法依賴的package包/類
@Override
public void moveUp(GenericTreeModel<T> model, T node)
{
	MutableTreeNode parent = (MutableTreeNode) node.getParent();
	parent.insert(node, parent.getIndex(node) - 1);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:7,代碼來源:GenericTreeModel.java

示例2: moveDown

import javax.swing.tree.MutableTreeNode; //導入方法依賴的package包/類
@Override
public void moveDown(GenericTreeModel<T> model, T node)
{
	MutableTreeNode parent = (MutableTreeNode) node.getParent();
	parent.insert(node, parent.getIndex(node) - 1);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:7,代碼來源:GenericTreeModel.java

示例3: CreateAtom

import javax.swing.tree.MutableTreeNode; //導入方法依賴的package包/類
/**
 * Create the frame.
 */
public CreateAtom(final AlloyAtom beforeAtom) {
  this.beforeAtom = beforeAtom;
  this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  this.setTitle("Create Atom");
  this.setBounds(100, 100, 450, 300);
  this.getContentPane().setLayout(new BorderLayout());
  this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  this.getContentPane().add(this.contentPanel, BorderLayout.CENTER);
  this.contentPanel.setLayout(new BorderLayout(0, 0));
  {
    final MutableTreeNode univ = new DefaultMutableTreeNode("Univ");
    this.tree = new JTree(univ);
    this.tree.setBorder(new MatteBorder(1, 1, 1, 1, new Color(0, 0, 0)));
    this.contentPanel.add(this.tree, BorderLayout.CENTER);
    this.tree.setCellRenderer(new CellRenderer());

    final List<MutableTreeNode> topElement = Utility.getTypeHierarchyForTree();

    for (final MutableTreeNode mutableTreeNode : topElement) {
      univ.insert(mutableTreeNode, univ.getChildCount());
    }
    final TreeNode root = (TreeNode) this.tree.getModel().getRoot();
    this.expandAll(this.tree, new TreePath(root));
  }
  if (this.beforeAtom == null) {
    final JPanel panel = new JPanel();
    this.contentPanel.add(panel, BorderLayout.NORTH);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    {
      final JLabel lblNewLabel = new JLabel("Atom Name : ");
      panel.add(lblNewLabel);
    }
    {
      this.textField = new JTextField();
      panel.add(this.textField);
      this.textField.setColumns(30);
    }
  }
  {
    final JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    this.getContentPane().add(buttonPane, BorderLayout.SOUTH);
    {
      final JButton okButton = new JButton("OK");
      okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent arg0) {
          if (CreateAtom.this.performFinish()) {
            Visualization.getInstance(null).revalidate();
            CreateAtom.this.disposeThis();
          }
        }
      });
      okButton.setActionCommand("OK");
      buttonPane.add(okButton);
      this.getRootPane().setDefaultButton(okButton);
    }
    {
      final JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
          CreateAtom.this.disposeThis();
        }
      });
      cancelButton.setActionCommand("Cancel");
      buttonPane.add(cancelButton);
    }
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:74,代碼來源:CreateAtom.java

示例4: leftShift

import javax.swing.tree.MutableTreeNode; //導入方法依賴的package包/類
/**
 * Overloads the left shift operator to provide an easy way to add
 * nodes to a MutableTreeNode.<p>
 *
 * @param self a MutableTreeNode
 * @param node a node to be added to the treeNode.
 * @return same treeNode, after the value was added to it.
 * @since 1.6.4
 */
public static MutableTreeNode leftShift(MutableTreeNode self, MutableTreeNode node) {
    self.insert(node, self.getChildCount());
    return self;
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:14,代碼來源:SwingGroovyMethods.java

示例5: putAt

import javax.swing.tree.MutableTreeNode; //導入方法依賴的package包/類
/**
 * Allow MutableTreeNode to work with subscript operators.<p>
 * <b>WARNING:</b> this operation does not replace the node at the
 * specified index, rather it inserts the node at that index, thus
 * increasing the size of the treeNode by 1.<p>
 *
 * @param self  a MutableTreeNode
 * @param index an index
 * @param node  the node to insert at the given index
 * @since 1.6.4
 */
public static void putAt(MutableTreeNode self, int index, MutableTreeNode node) {
    self.insert(node, index);
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:15,代碼來源:SwingGroovyMethods.java


注:本文中的javax.swing.tree.MutableTreeNode.insert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。