Undo changes in an arrayList
问题 I've an ArrayList of Line Objects called 'lines'. I made my own line class to draw lines with some constraints. It involves selecting two points in a panel and a line is drawn connecting the two points. Everytime a line is created, it is added to the 'lines'. The lines are drawn in a panel. The paint function in my panel looks like this: public void paintComponent(Graphics g){ super.paintComponent(g); for(final Line r:lines){ r.paint((Graphics2D)g); } } And everytime two points are clicked on