IndexOutOfBoundsException

Ok so I'm trying to create a drawing program, and it was working fine until I got a random error, I can't find what I messed up and I keep getting an error at nt point1 = (pointList.get(k)); Here is my whole code:

Your error is not random at all -- you're trying to get an item out of an array list that is beyond the size of the array list. In that loop you check the value of m but don't check whether or not k or k+3 is < the size of the pointList.

There are other poblems with your code including trying to do program logic from within a paint/paintComonent method.