I have a JFrame class TaskPane which contains jPanel2 and addButton. And jPanel2 in its turn contain taskPaneContainer. When we click addButton it adds dynamic Menu to jPanel2, for example Menu 1, Menu 2,... Every Menu consist Item and Delete Button, for example, Menu 1->Item1,Delete; Menu 2->Item2,Delete etc. I would like to ask when I added 3 Menu, i.e. Menu 1 [Item1], Menu 2 [Item2], Menu 3 [Item3], how can I get all actionCommand of Item Button, i.e. 1, 2, 3?
1
Expert's answer
2016-09-19T14:54:03-0400
You need to save al the dynamic menu in an array of this type and in lisener Menu3:
for( int i=0;i<arrayMenu.length;i++) { arrayMenu[i]./*Delete Menu*/; arrayMenu[i]=null; }
Comments
Leave a comment