本文整理汇总了Java中javax.swing.tree.DefaultMutableTreeNode.remove方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultMutableTreeNode.remove方法的具体用法?Java DefaultMutableTreeNode.remove怎么用?Java DefaultMutableTreeNode.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.tree.DefaultMutableTreeNode
的用法示例。
在下文中一共展示了DefaultMutableTreeNode.remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeProjectTab
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void removeProjectTab(ProjectWindowTab projectWindowTab) {
DefaultMutableTreeNode node = this.getTreeNode(projectWindowTab.getTitle());
if (node != null) {
DefaultMutableTreeNode pareNode = (DefaultMutableTreeNode) node.getParent();
pareNode.remove(node);
}
JComponent component = projectWindowTab.getJComponentForVisualization();
Container container = component.getParent();
if (container != null) {
container.remove(component);
}
this.tabVector.remove(projectWindowTab);
this.getTreeModel().reload();
this.projectTreeExpand2Level(3, true);
}
示例2: removeMultiple
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
protected void removeMultiple(DefaultMutableTreeNode node){
// --- Remind all needed informations -------------------------------------------
DefaultMutableTreeNode previousNode = node.getPreviousNode();
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
DynType dt = (DynType) node.getUserObject();
JPanel deletePanel = dt.getPanel();
JPanel parentPanel = (JPanel) deletePanel.getParent();
int movement = (deletePanel.getHeight() + 2) * (-1);
// --- Remove node from the parent node and panel -------------------------------
DynType dyntype = (DynType) node.getUserObject();
node.setUserObject(null);
parentNode.remove(node);
this.getTreeNodesByDynType().remove(dyntype);
// --- remove the panel from the parent -----------------------------------------
parentPanel.remove(deletePanel);
parentPanel.validate();
this.setPanelBounds(parentPanel);
// --- Now move the rest of the elements on the form ----------------------------
this.moveAfterAddOrRemove(movement, previousNode);
// --- refresh the GUI ----------------------------------------------------------
this.adjustPreferredSize();
}
示例3: actionPerformed
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == contentTextField || event.getSource() == saveButton)
{
saveText();
}
else if (event.getSource() == removeButton && canRemove)
{
int result = JOptionPane.showConfirmDialog(this, "Achtung!\n" +
"Wollen Sie wirklich diesen Text (" + textNode.getId() + ") löschen?", "Text löschen", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
{
DefaultMutableTreeNode parent = (DefaultMutableTreeNode) textNode.getParent();
parent.remove(textNode);
editor.updateTextNodes((DialogEditor.StatementNode) parent);
editor.updateTree(parent);
}
}
}
示例4: actionPerformed
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == nameTextField || event.getSource() == saveButton)
{
saveName();
}
else if (event.getSource() == removeButton)
{
int result = JOptionPane.showConfirmDialog(this, "Achtung!\n" +
"Wollen Sie wirklich diesen Dialog (" + dialogNode.getDialog().getName() + ") löschen?", "Dialog löschen", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
{
editor.getLevel().getDialogs().getDialog().remove(dialogNode.getDialog());
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)dialogNode.getParent();
parent.remove(dialogNode);
editor.updateTree(parent);
}
}
else if (event.getSource() == addStatementButton)
{
StatementType newStatement = new StatementType();
newStatement.setTalking("");
DefaultMutableTreeNode statementNode = editor.new StatementNode(dialogNode.getDialog(), newStatement);
dialogNode.add(statementNode);
TextsType newText = new TextsType();
newText.getText().add("");
statementNode.add(editor.new TextNode(dialogNode.getDialog(), newStatement, "", 0));
newStatement.setTexts(newText);
dialogNode.getDialog().getStatement().add(newStatement);
dialogNode.add(statementNode);
this.editor.updateTree(dialogNode);
}
}
示例5: actionPerformed
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == idTextField)
{
saveId();
}
else if (event.getSource() == titleTextField)
{
saveTitle();
}
else if (event.getSource() == imageCheckbox)
{
saveImage();
}
else if (event.getSource() == saveButton)
{
saveId();
saveTitle();
saveImage();
}
else if (event.getSource() == removeButton && canRemove)
{
int result = JOptionPane.showConfirmDialog(this, "Achtung!\n" +
"Wollen Sie wirklich diesen Charakter (" + characterNode.getCharacter().getId() + ") löschen?", "Charakter löschen", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
{
editor.getLevel().getCharacters().getCharacter().remove(characterNode.getCharacter());
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)characterNode.getParent();
parent.remove(characterNode);
editor.updateTree(parent);
}
}
}
示例6: actionPerformed
import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == displayModeNothing)
{
saveDisplayMode(DisplayModeEnum.NOTHING);
}
else if (event.getSource() == displayModePlayerOnly)
{
saveDisplayMode(DisplayModeEnum.PLAYER_ONLY);
}
else if (event.getSource() == displayModePlayerAndCharacter)
{
saveDisplayMode(DisplayModeEnum.PLAYER_AND_CHARACTER);
}
else if (event.getSource() == displayModeCharacter)
{
saveDisplayMode(DisplayModeEnum.CHARACTER);
}
else if (event.getSource() == displayModeTwoCharacters)
{
saveDisplayMode(DisplayModeEnum.TWO_CHARACTERS);
}
else if (event.getSource() == displayPositionSwap)
{
swapPosition();
}
else if (event.getSource() == displayTalking)
{
saveTalking();
}
else if (event.getSource() == displayCharacter1)
{
saveCharacter1();
}
else if (event.getSource() == displayCharacter2)
{
saveCharacter2();
}
else if (event.getSource() == soundTextField)
{
saveSound();
}
else if (event.getSource() == saveButton)
{
saveSound();
}
else if (event.getSource() == removeButton && canRemove)
{
int result = JOptionPane.showConfirmDialog(this, "Achtung!\n" +
"Wollen Sie wirklich dieses Statement löschen?", "Statement löschen", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
{
statementNode.getDialog().getStatement().remove(statementNode.getStatement());
DefaultMutableTreeNode parent = (DefaultMutableTreeNode) statementNode.getParent();
parent.remove(statementNode);
editor.updateTree(parent);
}
}
else if (event.getSource() == addTextButton)
{
String newText = "Neuer Text";
int id = statementNode.getStatement().getTexts().getText().size();
statementNode.getStatement().getTexts().getText().add(id, newText);
statementNode.add(editor.new TextNode(this.statementNode.getDialog(), statementNode.getStatement(), newText, id));
this.editor.updateTree(this.statementNode);
}
}