当前位置: 首页>>代码示例>>Java>>正文


Java PNode.removeChild方法代码示例

本文整理汇总了Java中edu.umd.cs.piccolo.PNode.removeChild方法的典型用法代码示例。如果您正苦于以下问题:Java PNode.removeChild方法的具体用法?Java PNode.removeChild怎么用?Java PNode.removeChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.umd.cs.piccolo.PNode的用法示例。


在下文中一共展示了PNode.removeChild方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateNumberOfMoleculeNodes

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateNumberOfMoleculeNodes( PNode parent, int count, double diameter, float transparency, Color color ) {

        // remove nodes
        while ( count < parent.getChildrenCount() && count >= 0 ) {
            parent.removeChild( parent.getChildrenCount() - 1 );
        }

        // add nodes
        while ( count > parent.getChildrenCount() ) {
            DotNode node = new DotNode( diameter, color, transparency );
            Point2D p = getRandomPoint();
            double x = p.getX() - ( node.getFullBoundsReference().getWidth() / 2 );
            double y = p.getY() - ( node.getFullBoundsReference().getHeight() / 2 );
            node.setOffset( x, y );
            parent.addChild( node );
        }
        
        assert( count == parent.getChildrenCount() );
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:DotsNode.java

示例2: updateNumberOfMoleculeNodes

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateNumberOfMoleculeNodes( PNode parent, int count, double scale, float transparency, Image image ) {

        // remove nodes
        while ( count < parent.getChildrenCount() && count >= 0 ) {
            parent.removeChild( parent.getChildrenCount() - 1 );
        }

        // add nodes
        while ( count > parent.getChildrenCount() ) {
            ImageNode node = new ImageNode( image, scale, transparency );
            Point2D p = getRandomPoint();
            double x = p.getX() - ( node.getFullBoundsReference().getWidth() / 2 );
            double y = p.getY() - ( node.getFullBoundsReference().getHeight() / 2 );
            node.setOffset( x, y );
            parent.addChild( node );
        }

        assert( count == parent.getChildrenCount() );
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:ImagesNode.java

示例3: updateMoleculeNodes

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateMoleculeNodes( PNode parent, Molecule molecule, int count ) {

        // remove nodes
        while ( count < parent.getChildrenCount() && count >= 0 ) {
            parent.removeChild( parent.getChildrenCount() - 1 );
        }

        // add nodes
        while ( count > parent.getChildrenCount() ) {
            // create node
            PImage node = new PImage( molecule.getImage() );
            node.setScale( MOLECULE_IMAGE_SCALE );
            parent.addChild( node );
            // move to a random location
            Point2D p = getRandomPoint();
            double x = p.getX() - ( node.getFullBoundsReference().getWidth() / 2 );
            double y = p.getY() - ( node.getFullBoundsReference().getHeight() / 2 );
            node.setOffset( x, y );
        }

        assert( count == parent.getChildrenCount() );
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:MoleculesNode.java

示例4: modelElementRemoved

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void modelElementRemoved( ModelElement modelElement ) {
    GraphicRecord graphicRecord = (GraphicRecord)modelElementToGraphicMap.get( modelElement );
    if( graphicRecord != null ) {
        PNode layer = graphicRecord.getLayer();
        PNode graphic = graphicRecord.getGraphic();
        layer.removeChild( graphic );
        modelElementToGraphicMap.remove( modelElement );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:ModelElementGraphicManager.java

示例5: removeLineNode

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private static void removeLineNode( Line line, PNode parent ) {
    for ( int i = 0; i < parent.getChildrenCount(); i++ ) {
        PNode node = parent.getChild( i );
        if ( node instanceof LineNode ) {
            LineNode lineNode = (LineNode) node;
            if ( lineNode.line == line ) {
                parent.removeChild( node );
                break;
            }
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:LineFormsGraphNode.java

示例6: removeNucleonNodeFromLayers

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private boolean removeNucleonNodeFromLayers( SubatomicParticleNode nucleonNode ) {
    boolean found = false;
    for ( PNode nucleusLayer : nucleusLayers ) {
        if ( nucleusLayer.removeChild( nucleonNode ) != null ) {
            found = true;
            break;
        }
    }
    return found;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:SchematicAtomNode.java

示例7: handleParticleRemoved

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
 * Handle the removal of the particle within the model that is being
 * represented in the view by this particle node.  This is done by
 * removing ourself from the canvas and by cleaning up any memory
 * references so that we can be garbage collected.
 */
private void handleParticleRemoved() {

    // Remove ourself from the canvas.
    PNode parent = getParent();
    if ( parent != null ) {
        parent.removeChild( this );
    }

    // Remove all children, since they have a reference to this object.
    removeAllChildren();

    // Explicitly clear our reference to the particle in the model.
    m_particle = null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:ParticleNode.java

示例8: modelElementRemoved

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void modelElementRemoved( ModelElement modelElement ) {
    ArrayList<NodeRecord> nodeRecordList = _nodeRecordsMap.get( modelElement );
    if ( nodeRecordList != null ) {
        for ( NodeRecord nodeRecord : new ArrayList<NodeRecord>( nodeRecordList ) ) {
            PNode node = nodeRecord.getNode();
            PNode parent = nodeRecord.getParent();
            parent.removeChild( node );
        }
        _nodeRecordsMap.remove( modelElement );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:ModelViewManager.java

示例9: createCurve

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void createCurve( MRModel model, PNode curveLayer ) {
    if( energyProfileGraphic != null ) {
        try {
            curveLayer.removeChild( energyProfileGraphic );
        }
        catch( ArrayIndexOutOfBoundsException e ) {

        }
    }
    energyProfileGraphic = new EnergyProfileGraphic( model.getEnergyProfile(),
                                                     curveAreaSize,
                                                     curveColor );
    curveLayer.addChild( energyProfileGraphic );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:CurvePane.java

示例10: modelElementRemoved

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
 * When a model element is removed from the model, we remove its associated graphic
 * from the layer it's on, and remove the graphic from our records
 *
 * @param modelElement
 */
public void modelElementRemoved( ModelElement modelElement ) {
    GraphicRecord graphicRecord = (GraphicRecord)modelElementToGraphicMap.get( modelElement );
    if( graphicRecord != null ) {
        PNode layer = graphicRecord.getLayer();
        PNode graphic = graphicRecord.getGraphic();
        layer.removeChild( graphic );
        modelElementToGraphicMap.remove( modelElement );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:ModelElementGraphicManager.java

示例11: removeFromCanvas

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void removeFromCanvas(PNode channelLayer, PNode edgeLayer){
	channelLayer.removeChild(this.channelLayer);
	edgeLayer.removeChild(this.edgeLayer);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:MembraneChannelNode.java

示例12: removeFromCanvas

import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void removeFromCanvas( PNode channelLayer, PNode edgeLayer ) {
    channelLayer.removeChild( this.channelLayer );
    edgeLayer.removeChild( this.edgeLayer );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:MembraneChannelNode.java


注:本文中的edu.umd.cs.piccolo.PNode.removeChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。