he method paintComponent(Graphics) is undefinedfor the type KeyAdapter
The compiler is saying that the super class for the KeyAdapter class does not have a paintComponent() method.
Is the paintComponent() method in the code defined in the correct class?
To be sure that the class has a method that can be overridden, add a @Override statement on the line just before the method definition. That asks the compiler to check if the class that the method is in has a method with that name and args.
One big problem with the code is its poor formatting. The { and }s are not properly positioned to show nested code. Fixing that will show you what the problem is.