keyRepeated() method is device dependent , you should avid using it,you can use keyPressed method by keeping track of previously pressed key codes.This gives you the same result as keyRepeated.