I have downloaded a snake game project from the internet, initially this project contains three java files namely 1. Engine.java 2. Snake.java 3. Gameoard.java
when i runs Engine.java ,game starts running ..
Now i have done some modification in it to improve the interactivity of the game, i.e i have added two #JDialog named 1. PlayGame.java
PlayGame.java has three JButtons :- Play button, Rules Button , Exit
-when play button gets clicked game should start
-when rules button gets clicked RulesDialog.java JDialog appears and when
-exit button gets clicked application or game should be closed.
Action of button is set in the actionPerformed() method of individual buttons.
Now problem i am facing is when i click Play button game window is visible on the screen but snake is not moving
and i am not getting to point how to resolve this problem ..
So plz help me out
Hi,
Somehow the method for moving is being not executed by the actionPerformed() method.
Debug the code in Eclipse and find out the bug.
Thanks
hey, after debuggign the project ,it does not display any error or warning message in the problem and console window.
when i click play button debugger show me this output
Thread [AWT-EventQueue-0] (Suspended (entry into method jButton1ActionPerformed in PlayGame)) PlayGame.jButton1ActionPerformed(ActionEvent) line: 89 PlayGame.access$0(PlayGame, ActionEvent) line: 87 PlayGame$1.actionPerformed(ActionEvent) line: 40 JButton(AbstractButton).fireActionPerformed(ActionEvent) line: not available AbstractButton$Handler.actionPerformed(ActionEvent) line: not available DefaultButtonModel.fireActionPerformed(ActionEvent) line: not available DefaultButtonModel.setPressed(boolean) line: not available BasicButtonListener.mouseReleased(MouseEvent) line: not available JButton(Component).processMouseEvent(MouseEvent) line: not available JButton(JComponent).processMouseEvent(MouseEvent) line: not available JButton(Component).processEvent(AWTEvent) line: not available JButton(Container).processEvent(AWTEvent) line: not available JButton(Component).dispatchEventImpl(AWTEvent) line: not available JButton(Container).dispatchEventImpl(AWTEvent) line: not available JButton(Component).dispatchEvent(AWTEvent) line: not available LightweightDispatcher.retargetMouseEvent(Component, int, MouseEvent) line: not available LightweightDispatcher.processMouseEvent(MouseEvent) line: not available LightweightDispatcher.dispatchEvent(AWTEvent) line: not available PlayGame(Container).dispatchEventImpl(AWTEvent) line: not available PlayGame(Window).dispatchEventImpl(AWTEvent) line: not available PlayGame(Component).dispatchEvent(AWTEvent) line: not available EventQueue.dispatchEventImpl(AWTEvent, Object) line: not available EventQueue.access$200(EventQueue, AWTEvent, Object) line: not available EventQueue$3.run() line: not available EventQueue$3.run() line: not available AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method] ProtectionDomain$1.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: not available ProtectionDomain$1.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext) line: not available EventQueue$4.run() line: not available EventQueue$4.run() line: not available AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method] ProtectionDomain$1.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: not available EventQueue.dispatchEvent(AWTEvent) line: not available EventDispatchThread.pumpOneEventForFilters(int) line: not available EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: not available EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: not available EventDispatchThread.pumpEvents(int, Conditional) line: not available EventDispatchThread.pumpEvents(Conditional) line: not available EventDispatchThread.run() line: not available
Can you please tell me how to resolve this