I have a JPanel that overrides the paintComponent method. I paint a rule from -10 to 470 mm
I do not want to repaint the whole component but when the mouse moves I need to set a red marker where the mouse is in the rule. How can I do this whithout repainting the whole JPanel?
Using an offscreen image for the unchanging part of the graphics and drawing the marker on top of it (between the image and the user) is one standard way.