当前位置: 首页>>代码示例>>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;未经允许,请勿转载。