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 7079055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:37:26+00:00 2026-05-28T06:37:26+00:00

How can I add keyboard shortcuts to a Java applet? I had an assignment

  • 0

How can I add keyboard shortcuts to a Java applet?

I had an assignment (I am taking Honors Computer Science) to make my name spin in a circle.
I used an infinite loop, and every time I want to end, I have to go to Task Manager and end the program. Can I add a shortcut that quits the applet?

For example, if I press the space bar, it will change to another part of the program.

I looked over “How to Use Key Bindings” at Oracle’s website but I could not understand it.

  • 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-28T06:37:27+00:00Added an answer on May 28, 2026 at 6:37 am

    If you are using Swing (if you are creating a JApplet), then yes, Key Bindings are the way to go. What about them confuses you?

    By the way, I know that this isn’t directly related to your question, but if your applet is a Swing JApplet, I wouldn’t use an infinite loop to do the animation, but rather I’d use a Swing Timer. If you use an infinite loop, you must take care to a) do the infinite loop in a background thread, and b) make most Swing calls from within the loop on the Swing event dispatch thread (or EDT) else you risk freezing the main Swing thread. A Swing Timer does all of this for you, and is thus much easier to use.

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

Sidebar

Related Questions

How can I add some keyboard shortcuts (ctrl/alt/shift + something) to focus textboxes and/or
I'm trying to add keyboard shortcuts to a GWT menu, same as in most
Extremely basic question. Are there common actions I can perform using keyboard shortcuts in
How I can add an additional condition for a certain keyboard key, to a
How can I trigger the software keyboard and add listeners to it's keys?
In TOAD, you have keyboard shortcuts where you can select the current block or
Ruby can add methods to the Number class and other core types to get
I can add and remove the last line in my dynamic form and calculate
I know I can add a icon to the Resources.resx file of a project
I know that I can add a HintPath to an external DLLs to help

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.