0

I have a class that extends JComponent and I want a method which draw the component, apparently I must not call paint() directly but repaint(), except that I need to paint in a graphics so I don't have much choices

Should I do :

@Override
public void paint(Graphics g) {
    super.paint(g);
    //draw things
}

or

public void draw(Graphics g) {
    this.paint(g);
    //draw things
}

or I don't call paint() at all ? It is said that paint() call others methods and especially transfert to subcomponents and I don't want to loose that

Josh Crozier
  • 219,308
  • 53
  • 366
  • 287
Spooky
  • 185
  • 1
  • 2
  • 12

0 Answers0