Hello ladies and gentleman
This being my first post on these forums I'm looking forward to becoming involved in this community.
That being said, I have an issue that I cannot solve on my own.
The following is a part of a university project to program a simple game, I have completed all necessary parts of the program but it refuses to work.
The 2 main issues I have with this are 1) Nothing is painted on the JPanel, it just shows the background color and 2) I've added in a line to test the functionality of the keyboard listener by letting the "move()" method print out the coordinates of the snake head every timer tick, however the listener does not seem to be registering my keys as the coordinates move in a single direction regardless of if or which keys I press.
If anyone can give me any tips it would be greatly appreciated.
no we are'nt in same class and acctually i want to make the background black but directly doing setBackground method does'nt do so why I dont know means in a blank frame when i set color of the background nothing happens so i made graphic object and when i set color then every object made using it will have that color so I did what actually happens can you tell me and what should I do to make this thing run..??
after that i changed i++ in snake move methood to i-- which was my mistake but still i m getting problem as shown
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 3, Size: 1