posted 20 years ago
You're going to need to use one of the Collections classes like ArrayList, LinkedList or Vector for this... if you're using a separate panel for each then this can hold references to the JPanel objects. If you're drawing each object as a rectangle inside a component's paintComponent() method you can store them as Rectangles. In either case, you're just going to construct a new JPanel or Rectangle, add it to the list, and repaint.
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.