Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6021055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:39:25+00:00 2026-05-23T03:39:25+00:00

Alright, i’m making a small pong game, and, i’m making a start menu for

  • 0

Alright, i’m making a small pong game, and, i’m making a start menu for it. It’s like, you start up the game, get a menu, you click on play, and then the game starts, now, everything works exactly as I wanted, except for one thing. When I click the button, everything gets drawn, the ball starts going, everything updates correctly, BUT, I can’t move my players anymore. It’s like the KeyListener has stopped working, my program suddenly stops reacting to keys. I’ll give you guys all of my source code for the game, because, I am puzzled, I have no idea what’s causing it, or how to fix it. My menu works by changing a boolean when you press the button, when the boolean is false, draw the start menu, and when it’s true, draw the game.
Right, since it’s alot of code, I will upload it to pastebin.

PongWindow.java(includes main) http://pastebin.com/S5CpWW5Q

PongDrawing.java(includes drawing,moving,keylisteners,main game loop, and all of that) http://pastebin.com/x2LxkkbP

PongPlayer.java(the player) http://pastebin.com/N8VWTL0P

PongBall.java(the ball) http://pastebin.com/temGc2Yg

If you guys can figure out why it’s not listening to my keys anymore, please tell, I have no idea.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:39:26+00:00Added an answer on May 23, 2026 at 3:39 am

    It’s like the KeyListener has stopped working,

    Key events are only passed to components that have focus. If you click on a button then your game panel no longer has focus. You need to use something like:

    gamePanel.requestFocusInWindow();
    

    in your ActionListener code.

    However the proper way to do this is to forget about using a KeyListener and instead use Key Bindings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, i'm making a small game, and I need to limit my FPS, because,
Alright. So I figure it's about time I get into unit testing, since everyone's
Alright, I'm trying to read a comma delimited file and then put that into
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
alright so I am trying to read a text file. and then split it
Alright so here it goes, I have my user system working perfectly, and now
Alright, to start with let's look at some code: <html> <body> <script type=text/javascript> function
Alright, I've been working on this for a while and cannot get it. I'm
Alright guys, this should be a very simple request. I'd like to run a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.