Q: Java PaintComponent: HowTo So, I want to paint something on a Panel, using PaintComponent. But I want to do it in a Constructor. So, for example:
public class Interfata extends JPanel
{ 
   public void paintComponent(Graphics g)
  {
     super.paintComponent(g);
     g.setColor(Color.red);
     g.drawOval(500, 500, 50, 40);
  }

  public Interfata()
 {
         // code here
 }

  public static void main(String[] args)
 {
    Interfata i = new Interfata(); 
 }

The code should be like this model. The problem is that I don't know how to call the paintComponent method on a panel that create in the Constructor. ( Even though it may seem inefficient, I create the frame, panel and all the functions in the constructor, so, that I just have to instantiate that object in the main method). If I weren't clear enough, please do ask for any detail you may find suitable.
Edit: So to be more specific, this is how my Constructor looks like:
public Interfata()
{

    // main interface
    JFrame frame = new JFrame("Queue");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(1000, 450);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (int) ((d.getWidth() - frame.getWidth()) / 2);
    int y = (int) ((d.getHeight() - frame.getHeight()) / 2);
    frame.setLocation(x, y);

    //simulation interface
    JFrame f = new JFrame("Simulare");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setSize(900, 800);
    int x1 = (int) ((d.getWidth() - frame.getWidth()) / 2);
    int y1 = (int) ((d.getHeight() - frame.getHeight()) / 2);
    f.setLocation(x1, y1); 

    JPanel panel = new JPanel();
    panel.setLayout(null);

    JPanel panel1 = new JPanel();
    panel1.setLayout(null);


    JLabel l1 = new JLabel("Intervalul minim de asteptare: ");
    JTextArea tf1 = new JTextArea();
    panel.add(l1);
    l1.setBounds(5,10,200,25);
    panel.add(tf1);
    tf1.setBounds(200,10,300,20);

    JLabel l2 = new JLabel("Intervalul maxim de asteptare: ");
    JTextArea tf2 = new JTextArea();
    panel.add(l2);
    l2.setBounds(5,50,200,25);
    panel.add(tf2);
    tf2.setBounds(200,50,300,20);

    JLabel l3 = new JLabel("Duarata minima pentru serviciu: ");
    JTextArea tf3 = new JTextArea();
    panel.add(l3);
    l3.setBounds(5,90,200,25);
    panel.add(tf3);
    tf3.setBounds(200,90,300,20);

    JLabel l4 = new JLabel("Durata maxima pentru serviciu: ");
    JTextArea tf4 = new JTextArea();
    panel.add(l4);
    l4.setBounds(5,130,200,25);
    panel.add(tf4);
    tf4.setBounds(200,130,300,20);

    JLabel l5 = new JLabel("Numarul de cozi: ");
    JTextArea tf5 = new JTextArea();
    panel.add(l5);
    l5.setBounds(5,170,100,25);
    panel.add(tf5);
    tf5.setBounds(200,170,300,20);

    JLabel l6 = new JLabel("Intervalul de simulare: ");
    JTextArea tf6 = new JTextArea();
    panel.add(l6);
    l6.setBounds(5,210,150,25);
    panel.add(tf6);
    tf6.setBounds(200,210,300,20);

    JButton b1 = new JButton("Simulare");
    panel.add(b1);
    b1.setBounds(700,100,100,35);
    b1.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            f.setVisible(true);

        }
    });

    frame.setContentPane(panel);
    frame.setVisible(true);
    f.setContentPane(panel1);
}

What I want to do exactly, is paint something in the panel of the NEW FRAME, or more specificaly, in the frame f. 
