Welcome to the Ranch
You should try one thing at a time, and one thing only. If you try too much you will simply tie yourself in knots. Suggest you start with one of the sorting algorithms, displaying the state of the array after each pass.
I think you are aiming for something like
this, but you should leave that till later. And don't override repaint.