I have seen at least 2 ways of displaying graphics and animating in java, for example in order to make a game. One uses the paint method, which would appear to be pretty simple. The other uses a while loop, inside of which you configure your fps, your tps (ticks per second), then you update your program's information, and finally you render the graphics.
This last way appears to have nothing to do with the paint method, so I don't understand. Are these different ways of approaching the same problem? Is there a diference? I am experimenting with game making in java (I have been for only a week or so) and this seems to be a key element, but I'm still not getting it.