Posted: Tue Apr 19, 2005 10:54 pm Post subject: drawing on panels
hi, im making a program for compsci class. it involves clicking various radio buttons on one panel to change the shape which is drawn on a different panel.
the structure of my code is like this :
code:
public class RadioShapes extends JFrame
{
public RadioShapes(){}
public void paintComponent(){}
class RadioButtonListener implements actionListener
{
public void actionPerformed(ActionEvent e){}
}
}
the class RadioButtonListener waits for the user to click on a specific button. the actionPerformed method recognizes that and assigns an int value of 1, 2 or 3 to a variable. the paintComponent reads this variable then draws the shape on the panel for the shapes.
the problem i have here is - in paintComponent, how do i specify which panel to draw to? my program compiles and executes, but the shapes do not appear. the listeners are working just fine. any ideas?
[/code]