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


Java DefaultMutableTreeNode.remove方法代碼示例

本文整理匯總了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);
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:20,代碼來源:ProjectWindow.java

示例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();
	
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:32,代碼來源:DynForm.java

示例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);
        }
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:21,代碼來源:TextEditorPanel.java

示例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);
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:38,代碼來源:DialogEditorPanel.java

示例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);
        }
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:35,代碼來源:CharacterEditorPanel.java

示例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);
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:74,代碼來源:StatementEditorPanel.java


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