0

I have created a GlassPane with the intention to be able to create a tool capable of annotating on the current screen. I am currently using an arrayList of points storing the location of places to color in. That part currently works well.

Now I am trying to create an eraser for the program by deleting portions of the arrayList and calling repaint().

Below is the code for adding points to the arrayList of points to be drawn using mouseDragged(MouseEvent e).

if (GlassPane.locations.size() == 0 || GlassPane.locations.size() == 1) {
    GlassPane.locations.add(MouseInfo.getPointerInfo().getLocation());
    current++;
} 
else {
    double dist = distance(GlassPane.locations.get((int) (current - 1)), MouseInfo.getPointerInfo().getLocation());
    if (dist >= 1) {
        GlassPane.locations.add(MouseInfo.getPointerInfo().getLocation());
        current++;          
    }
}
Bryan Ho
  • 13
  • 1
  • 5
  • 2
    Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses – MadProgrammer Aug 29 '14 at 00:43
  • If you're having trouble clicking on the screen, I'd just put all those points in a JList or similar, and remove them directly by clicking on an entry in the GUI. Seems easier. – markspace Aug 29 '14 at 00:53

0 Answers0