I\'m trying to implement a method to paint a specific portion of a grid. To do so I overrided the paintComponent method:
public class Frame extends JPanel {
...
Change
public void specificPaint(int coordinateX, int coordinateY, Color color)
to
public void specificPaint(int coordinateX, int coordinateY, Color color, Graphics g)
Then call specificPaint inside your paintComponent method with the Graphics object you are drawing with
See Hovercraft's answer for more details as to why using this.getGraphics() doesn't work