I have been making a 2d fighting game in java over the last few months but have always had the same annoying issue that after a few times of closing and re running the game, it will always suddenly drastically slow down to a set speed/frame rate. This happens on my not so great laptop as well as my gaming pc so I don't think it's a performance issue.
For some reason it is also related to when I start up my computer, as if I restart my computer it will run smoothly, and then soon after when I run it again it will go back to running in slow motion.
I am using swing timers and a paintComponent method to create the game.
Thanks