Before doing any drawing, you usually have to set an appropriate color in the graphics context. Otherwise it may be set to some random value from the previous user of the graphics context, or a default value like the background color.
In the example above, adding the following will make the graphics visible:
g.setColor(Color.RED);