posted 15 years ago
This is s program that allows a user to draw shapes by inputting the specifications(size, location, color etc). The user can select a shape and edit or delete it after creating it. I created JLabels and added MouseListeners to them. These JLabels are created when the main program runs but they are not shown yet. When a user creates/draws a shape, a label's setText is set and the label is displayed(the arrayList is updated as well). The problem is that I dont know how many shapes the user is going to create, so I dont know how many labels I need. And all these labels need MouseListeners because clicking on a label means selecting the shape associated with. So you can click on a label and you will be able to edit or delete the shape associated that label. I tried creating the labels in the actionEvent method for the shapes but they cannot be displayed if i create them there.