I'm making a game in java right now. I've looked around at various tutorials for making Java games and there doesn't seem to be a consistent way to access a Graphics object to draw stuff on the screen.
Three of the different ways have been
- Overriding the paintComponent() method in a class that extends JPanel
- Using the getGraphics() method to get the graphics object in a class that extends JPanel
- Creating a BufferStrategy object and using the getDrawGraphics() method to get the graphics object to draw
All three implementations seem to work, I'm just confused about the difference between them, and in which situations would you use each?