```
public void paintComponent(Graphics g){
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g;
        g2.fillRect(0,0,25,25);
}

```

OR

```
public void paintComponent(Graphics g){
    Graphics2D g2 = (Graphics2D) g;
    super.paintComponent(g2);
    g2.fillRect(0,0,25,25);
}

```

Which would be correct if I was using Graphics2D? Would I still paintComponent(g) or pass that to g2 instead?

Sorry if this is a stupid question, I would use the second one but I just want to know which would be the correct way in case I'm doing something wrong.