I am currently working on a paint program and had implemented undo & redo methods, but as my program was slowing down as the user drew, I decided to not store the co - ords in an ArrayList, but directly apply them to a BufferedImage. The problem with this method is that I cannot undo or redo as I used to. I have searched around on the interweb, and found a reference to a class called UndoManager. I have no idea how to apply it to a graphics object, though (given my condition).
I can still store the co-ords, but that is useless to me as I draw them on directly, unless anyone could think of a way to overlay a black colored line w/ a transparent one to replace it (Currently, for that purpose I use BufferedImage.setRGB(x,y,color), but that only helps when the shape I want to replace is a circle (x^2 + y^2 = r^2) or rectangle).
Any ideas?