I have to make a program for a school assignment that draws a x number of ovals when you type in a number in a JTextfield.
Normally I know how to do it. But I have to do it in 3 different classes, a class Main, MyFrame and MyPanel.
Now I don't know how to draw the circles in the MyFrame class with a for loop in the ActionListener.
This is what I got so far.
(Made this in Netbeans so that's where the package is for)
public class Main
public static void main(String arg)
public class MyFrame extends JFrame implements ActionListener
private MyPanel mp;
public JTextField tf;
private JButton b1;
mp = new MyPanel();
tf = new JTextField(20);
Container c = getContentPane();
JPanel p = new JPanel();
public void actionPerformed(ActionEvent e)
public class MyPanel extends JPanel
setPreferredSize(new Dimension(900, 1000));
public void paintComponent(Graphics g)
Hope someone got an answer for me !
Edited by SterAllures, 02 March 2010 - 05:02 AM.