I am starting Java and found this interesting.
In Java AWT when we create a button then we use an ActionListener and then we write a paint()
function.
But when we create a checkbox then we use an ItemListener and in the paint()
function we use repaint()
and then we write repaint()
. Why do we use repaint()
? Why do we not use repaint()
in case of an ActionListener?