Deleting nodes in Scene.

Hi,
I have a fully working 'JavaFX create graphics application' (e.g. y = x^2). But unfortunately, I did not succeed to delete the previous line after creating a new graphic line. I already tried to delete the regarding nodes by using an id. That seemed to work (it prints the message 'deleted' on the next line), but unfortunately I still see the previous line on the screen. Any body have some idea how to delete the previous line?
I hope someone can help me. Thanks!
import ...
var sceneRef : Scene;
var textBox : TextBox;
Stage {
    title: "Draw Graphics"
    scene: sceneRef = Scene {
        width: 980
        height: 700
        content: [
            textBox = TextBox {
                layoutX:30
                layoutY:30
                text: "x"
            Button {
                layoutX : 230
                layoutY: 30
                text: "Draw!"
                action: function() {
                     draw();
         // etc...
function draw() : Void {
    // delete previous line
    for(i in [0..sizeof sceneRef.content]){
        if(sceneRef.content.id == "textRefId"){
delete sceneRef.content[i] from sceneRef.content; //this does not work!
println("deleted"); //prints 'deleted'
// draw new line
for (xxx in [0.0 .. 32.0 step 0.01]) {
var textRef = Text {
id: "textRefId"
layoutX: getRealX(xxx)
layoutY: getRealY(calculateY(xxx))
content: "."
fill: Color.BLUE
insert textRef into sceneRef.content;
// etc other functions...

First, there is a thing that strikes me: you create lot of objects with same ID. See Node's ref., at String ID: "+Each node in the scene graph can be given a unique id. This id is much like the "id" attribute of an HTML tag in that it is up to the designer and developer to ensure that the id is unique within the scene graph.+"
You can use styleClass if you want a way to mark the nodes.
But it might be more efficient to add a Group to the scene and to put your "points" there. Thus you can just delete and re-create the group to get rid of everything at once.
I wonder why you use Text nodes for the points, why not Circle? Or, even, Line between previous point and current one?

Similar Messages

  • Remove Node from Scene

    Hi,
    I am quite new to JavaFX.
    What I need is to remove a node from the scene.
    I tried with "delete node" and "node = null" but the graphics of the node don't dissapear from the scene.
    Any help on this?

    nothing :(
    my code is:
    delete RauGroup.content[3] from RauScene.content;where RauScene is:
    var RauScene:Scene = Scene{
            content:[
                    HBox{
                            content:[
                                    SettingsGroup,
                                    RauSettingsToggleButton,
                                    RauGroup
    }I also tried removing the whole RauGroup from the RauScene but with no different outcome :/

  • Help needed in deleting nodes from RAC database

    Our DB is 10g RAC database and the servers are Window 2003 server. Initially the database was configured to have 4 nodes. For some reason we stopped the instances in the first two nodes and the current database is running on node3 and node4. I queried the v$thread view and it shows 3 records. Thread 2 is closed and disabled. Thread 3 is open and public and thread 4 is open and private. Now we need to disconnect nodes 1 and 2 from RAC db and cluster ware (We use Oracle cluster ware) and plan to use those two servers for other purposes. Although I read through the Oracle doc regarding deleting node from RAC “11 Adding and Deleting Nodes and Instances on Windows-Based Systems” and wrote down the steps we need to take but I am still not comfortable in doing it since it is production env and we don’t have any dev env to practice those steps. So I would like to borrow your experiences and your lessons learned while you were doing those. Please share your thoughts and insights with us.
    Thank you so much for your help,
    Shirley

    what's your full version? I can warn about specific issues in 10.1.0.3 and 10.2.0.1 - for example, in some cases (depending on how the listener was configured), it will be impossible to delete the listener for the deleted node. Known bug.
    To avoid many many known bugs, you may want to upgrade to at least 10.2.0.2 before removing a node (from my experience, this is the first stable RAC version).
    In any case, deleting a node is a rather delicate process. I really really recommend practicing. Take any pc/laptop, install VMWARE, define two virtual machines, install RAC and remove one node. It will take you an extra day or two, and could save your production.

  • I deleted nodes with the web developer and the deletion has become permanent. How to undo?

    I was trying to remove all the "Recommended Pages" etc. garbage on the right-hand side of Facebook and got a little click happy with 'delete nodes' using the Web Dev tools - as cathartic as it was! :)
    Now it seems as though I have broken FB on Firefox (seems to work fine on IE, surprisingly) as pics seem to be missing and the left-hand menu as well - but, of course the stuff I was trying to rid myself of comes back just fine ... sigh.
    I've read that all changes are supposed to be temporary until you restart the browser but this hasn't helped at all and I did try unchecking the 'Use hardware acceleration when available' that I read somewhere else, to no avail.
    Any assistance that can be rendered would be very much appreciated.
    For the record, I've learned my lesson and won't futz around with this anymore! :)

    For a node deletion in the Inspector tool,revert that by reloading the page. If that isn't working for you, you could try Command+Shift+r to reload the page bypassing the cache.
    You can check for problems with the sessionstore.js and sessionstore.bak files in the Firefox Profile Folder that store session data.
    Delete the sessionstore.js file and possible sessionstore-##.js files with a number and sessionstore.bak in the Firefox Profile Folder.
    HT > Profile Directory: Open Containing Folder
    http://kb.mozillazine.org/Profile_folder_-_Firefox
    Deleting sessionstore.js will cause App Tabs and Tab Groups and open and closed (undo) tabs to get lost, so you will have to create them again (make a note or bookmark them).
    http://kb.mozillazine.org/Multiple_profile_files_created

  • Program to add node /  delete node in the tree control via abap object

    Hi all,
    i am new to abap objects.
    Can anyone help me out to give program about add node , delete node at
    a particular point in tree hierarchy.
    folder1                     -- level 1
    subfolder1          -- level 2
    *********subfolder1   -- level 3
    *********subfolder2  -- level 3
    subfolder2          -- level 2
    folder2                     -- level 1
    if i select level3 and click on ADD button .....i get a facility to add new node
    at level 3 and and same thing can happen at level1 and level2 ............ if i select
    and folder at level3 and click on delete button ....it should delete that folder...
    if you do not have such program ........then guide me how to achieve this target via object oriented because i have to split the screen also and have to show some alve display in that.
    just guide me how to add and delete node at a particular level in tree structure....
    thanks in advance........

    Hello Ravi,
    Try this demo program:
    <b>BCALV_TREE_01</b>
    <b>BCALV_TREE_DEMO</b>
    BCALV_TREE_SIMPLE_DEMO
    Also try:
    BCALV_TREE_02
    BCALV_TREE_03
    BCALV_TREE_04
    BCALV_TREE_05
    BCALV_TREE_06
    regards,
    Beejal
    **reward if this helps

  • Delete node elements

    I have created 5 elements of a node . I want to delete nodes. But it is giving error .
    Context
              sample (node )    [ cardinality 0...n , selection 0..1 ]
                          name (attr)
                          number(attr)
    code :
    public void onActioncreate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActioncreate(ServerEvent)
        for(int i=0;i<5;i++){
             IPrivateClearnodeElements.ISampleNode node =wdContext.nodeSample();
             IPrivateClearnodeElements.ISampleElement ele = node.createSampleElement();
             ele.setName("Name "+i +" : " );
             ele.setNumber(i+"");
             node.addElement(ele);
        //@@end
      public void onActionclear(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionclear(ServerEvent)
        wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeSample().size()+"");
        for(int i=0;i<5;i++)
              try{
              wdContext.nodeSample().removeElement(wdContext.nodeSample().getSampleElementAt(i));
              wdComponentAPI.getMessageManager().reportSuccess("Deleted : "+ i+"");
              catch(Exception e)
                   wdComponentAPI.getMessageManager().reportSuccess(e.getMessage()" : " i+"");
        //@@end
    output :
    5
    Deleted : 0
    Deleted : 1
    Deleted : 2
    Index: 3, Size: 2 : 3
    Index: 4, Size: 2 : 4
    Why it is not able to delete the last two node elements ????????????????//
    Also any other way is there to  delete  elements of the node?
    Srini

    Hi srinivasa,
    You have used the code to delete the element
    for(int i=0;i<5;i++)
    try{
    wdContext.nodeSample().removeElement(wdContext.nodeSample().getSampleElementAt(i));
    wdComponentAPI.getMessageManager().reportSuccess("Deleted : "+ i+"");
    catch(Exception e)
    wdComponentAPI.getMessageManager().reportSuccess(e.getMessage()" : " i+"");
    Now.. See getSampleElementAt(i) method returns the element of i th element. On that case you have to use
    getSampleElementAt(0). In that case it wiil return 0ih element end 0th element will be deleted. After deletion the 0th element 1st element will move to the 0th position.
    So. in that way you can delete all the elements.

  • Urgent!!!! Add/Delete nodes

    Hi Friends!
    How to add/delete nodes at any level and update the base table whenever I add/delete nodes to the tree?
    Thanks

    There are 2 kinds of XML parsers : SAX and DOM. DOM seems to suit your need. You can use JAXP APIs to add, delete or change nodes or attributes.
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/TOC.html provides contents that would satisfy most of the needs.
    To save a DOM modified XML file use java IO APIs to write to the same file from which it was read using a Document object ( doc.getNodeValue() ).

  • Using Java, How can I Update, Add, Delete nodes in XML Files.

    Hi,
    I want to store the student record (like Name, Age, school name, total mark etc.,) as nodes in the XMLfile. Also I should able to Update, Add, Delete any nodes (student record) in the XML file. How can I achieve this...using Java
    I am able to read the content of the xml file using xml-parser. But my problem is
    updating the xml file.
    pls suggest some solutions or links with " example source code"
    Thanks :-)

    There are 2 kinds of XML parsers : SAX and DOM. DOM seems to suit your need. You can use JAXP APIs to add, delete or change nodes or attributes.
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/TOC.html provides contents that would satisfy most of the needs.
    To save a DOM modified XML file use java IO APIs to write to the same file from which it was read using a Document object ( doc.getNodeValue() ).

  • How can i add and delete node in tree in run time

    i want to know the method that let me select tree node to delete it and another to input upon user inputs

    Hello,
    why don't you just enter "add tree node" in the Search Forum search box ?
    There are plenty of samples.
    Francois

  • Help on Deleting Node in Tree?

    I'm trying to delete a node on a tree and some weird stuff is
    occurring. Here is my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    initialize="init();" layout="absolute">
    <mx:Script>
    <![CDATA[
    private function click () : void {
    if (MyTree.selectedItems.length > 0) {
    var items:Array = MyTree.selectedItems;
    for (var i:int = 0; i < items.length; i++) {
    var nodeToDelete:XML = XML(items
    var xlcParent:XMLListCollection = new
    XMLListCollection(nodeToDelete.parent().children());
    var iIndex:int = xlcParent.getItemIndex(nodeToDelete);
    xlcParent.removeItemAt(iIndex);
    ]]>
    </mx:Script>
    <mx:XMLListCollection id="MyDP">
    <mx:XMLList>
    <root label="Default Policy">
    <node label="node1"/>
    <node label="node2"/>
    <node label="node3"/>
    <node label="node4"/>
    <node label="node5">
    <node label="node1"/>
    <node label="node2"/>
    <node label="node3"/>
    <node label="node4"/>
    <node label="node5">
    <node label="node1"/>
    <node label="node2"/>
    <node label="node3"/>
    <node label="node4"/>
    </node>
    </node>
    </root>
    </mx:XMLList>
    </mx:XMLListCollection>
    <mx:Tree labelField="@label" id="MyTree"
    dataProvider="{MyDP}" x="141" y="109" width="528" height="440"/>
    <mx:Button click="click();" x="141" y="557" label="Delete
    Selected Node"/>
    </mx:Application>
    For some reason when I expand all the nodes and try to delete
    one of the great grand children all of the great grand children
    shift over as if they are siblings of the node that I deleted the
    great grand children from.
    Anyone have some good ideas? I sure wish deletion of nodes
    was as easy as in actionscript 2.0

    There a quite a few posts about this problem here already -
    it seems to be a tree rendering bug (seems to come in various
    different flavours).
    The safest work around after fiddling with the nodes in the
    tree is to get the axe out and reassign the data provider. To be
    nice to the user, you might want to keep the expansion state (this
    may not work if you made big "structural" changes to the tree).
    The following works for me (after your changed the tree data
    model):
    var openItems:Object = treeopenItems;
    tree.dataProvider = tree.dataProvider;
    this.openItems = openItems;
    Hope this helps.
    Robert.

  • Deleting nodes in tree structure

    Hi All,
    I have created a classical tree strcuture. Now I need to implement a delete functionality. This should delete all the nodes that are selected. If the node is a parent node, then, when I press the delete button, I should find both the parent and the child nodes deleted. How do I build a logic for this. Any help

    you can read  the table node_table with nody key value which imports when docubble click the the tree node (Double clifk event).
    Regards,
    Gopi .
    Reward points if helpfull.

  • How to Delete Nodes in XI 3.0

    We have 2 type of Nodes:-
    IMAIL
    SMTP
    I want to delete SMTP notes, but its give me an error notes cannot be deleted or copied
    even i tried that client 000, and IMAIL can be deleted easly....
    Please advise
    thanks

    You select the part you want to highlight with the mouse(cursor), then you can either press Ctrl+M or click on the button in the top part. You can also write a note on the highlight part.
    Thats the bad part about DE, you can not apropriate edit your book. Thats terrible for study books, where different colors for highlight and underlines would be great. Hey Adobe team, remember that for the next versions.

  • Deleting Nodes from XML Tree (JTree)

    I have created a XML Tree(extended from JTree) using XNodes ( extended from DefaultMutableTreeNode)
    After some insertions, i need to delete certain nodes from the XML Tree.. but after deletion, XNode will be null.
    subroutine is as follows...
    appreciates any advice
    Thanx
    private XNode RemoveExtraNode( XNode xNode ){
    int child;
    String nodeType;
    XNode childNode=null;
    if ( (child=xNode.getChildCount() ) > 0){
    for(int i=0;i<child;i++){
    childNode=(XNode)xNode.getChildAt(i);          
         nodeType = childNode.getType();
         if(nodeType.equals("DTD") )
         childNode.removeFromParent();
    }//end for (int i=1;i<child;i++)
    }//endif((child=xNode.getChildCount())!=0)
    return xNode;     
    }//RemoveExtraNode

    Hi IKEDA
    Thanx for the reply.
    I have tried xNode.remove(childNode) b4 and it still return a null JTree.
    Anyway fyi i discover i can delete last child of xNode and return the correct java tree. therefore to delete a node of my choice i simply insert its next sibling nodes in its place and delete that particular node when it becomes the last child.

  • Deleting nodes in Color

    If you add or have nodes visible in ColorFX - how do you delete them?
    Thanks

    Select/hilite the node, press "delete". Gone. Re-establish broken connections.
    jPo

  • Deleting nodes

    Dear all,
    I have a DOM tree and I want to delete some nodes,
    without deleting that node's children. Is this possible?
    Cheers, Fred

    I believe if you delete a node then all of it's children go with it.
    Try appending the nodes you want to keep to where you will want them to go first. Once they are in their new location, then delete the node you no longer want.

Maybe you are looking for

  • STILL having problems with 1.2

    I am one of the people whose iPod died as soon as they got the iPod software 1.2 update loaded on. Now, 3 months later... Yes, three months, later, I took a chance and updated it again (after reverting back to 1.1.2) and the same **** thing happens.

  • HT2905 How do I delete songs on my IPod Shuffle and start again?

    I noticed that I have the same songs on my IPod Shuffle 4th generation, how can I delete all from my IPOD and redownload again?

  • Re: run length encoding question

    I have this string: String s = "########## \r\n# #########\r\n"; I want to run length encode the results. I am successful at encoding it: 10#6-|#5-9#| // I am using a delimeter here: "|". I am also using the replace ('-') for whitespace I need help w

  • Error in Cisco Network Assistant 5.2

    telnet_launch_helper.bat pops up everytime I try to right click and telnet. Any ideas? John

  • Anyone using ASP and Dreamweaver

    Hey everyone, This article is sadly out of date and we are looking for something to replace it: http://www.adobe.com/devnet/dreamweaver/articles/setting_up_asp.html My thinking is that someone out there has already written these instructions and post