posted 21 years ago
Your addComponent() method implicitly calls add() on (what I imagine is) your JFrame object -- i.e., an object of the class that all this code is defined in. You could change addComponent() to take another argument, the container to add the component to; then instead of calling just add(), you'd call container.add() -- i.e.,