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
  • 233,099
  • 56
  • 391
  • 304
Spooky
  • 315
  • 1
  • 3
  • 12

0 Answers0