Visual sorting written in java