I am trying to draw on the glass pane part of a JFrame
with a marker using g.fillPolygon(xValues, yValues, numPoints)
after making the background of the JFrame
transparent.
I am using a method to find the location of the cursor and can get the right locations. To force the call of paintComponent(Graphics g)
, I am using myGlassPane.repaint()
but this deletes the previous part of the segment that I drew.
I am wondering if there is a way to retain what was previously drawn through the paintComponent(Graphics g)
method.