What I'm trying to do is dynamicly edit a panel and readd it to the (Border)layout. The panel contains textfields and I want the user to be able to add or remove textfields to the panel. What I tried is the following: remove the panel from the layout, add another textfield to the panel, readd the panel to the layout. However this doesn't work ( nothing happened; only the panel was removed but not readded with the new textfield in it , so the area was just empty ). Even when I removed the panel from the layout and then added another component to the layout at that position (BorderLayout.EAST) instead; nothing happened ( just empty ).
This is the part of the code which is not working:
vfields[blocks] = new TextField("0"); //add new textfield to the array of textfields
blocks += 1;
dp.blocks = blocks;
this.remove(values_fields); //remove the values_fields panel from the borderlayout
values_fields.add(vfields[blocks]); //add new component,textfield to the panel
this.add(values_fields, BorderLayout.EAST); //readd the panel to the border layout<-- doesn't work
I hope anyone can help me out. I'm relative new to Java so I might just be doing something totally wrong or something, but I don't see it myself.
Thanks in advance!
Skyfe.