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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:10:10+00:00 2026-05-10T23:10:10+00:00

ANSWER: If you ever see these lines and are mistified like I was, here’s

  • 0

ANSWER:

If you ever see these lines and are mistified like I was, here’s what they mean.

Thread[AWT-EventQueue-0] (Suspended (exception NullPointerException))

EventDispatchTread.run() line: not available [local variables unavailable]

It’s not that the variables are unavailable because they are lurking behind a shroud of mystery in a library somewhere dank. No no, they just went out of scope! It’s still your fault, you still have to find the null, and no you can’t blame the library. Important lesson!

QUESTION:

One of the most frustrating things for me, as a beginner is libraries! It’s a love/hate relationship: On the one hand they let me do things I wouldn’t normally understand how to do with the code that I do understand, on the other hand because I don’t completely understand them, they sometimes throw a wrench in code that is otherwise working fine! It’s because I don’t understand the errors that can occur when using these libraries, because I didn’t write them, and because eclipse doesn’t give me a great deal to go with when one of imports starts acting up…

So here’s the problem: I’ve been working with java.awt.event to handle a bunch of JButtons on the screen for this and that. I get an error when I use one of the buttons I’ve made. The error is:

Thread[AWT-EventQueue-0] (Suspended (exception NullPointerException))

EventDispatchTread.run() line: not available [local variables unavailable]

What does this mean? What could be causing it? I’m embarrassed to post code, but if you can stand to try to decipher my terrible style, here is the method that seems to cause this error to be thrown.

public void actionPerformed(ActionEvent e) {     String cmd = e.getActionCommand();     String name;  code...  if(cmd.equals("Play")) {         name = field.getText();         card = getCard(name);                  if(card != null) {             if(rules.zoneHasCard(card, rules.hand)) {                 display.updateStatusMessage(rules.play(card));                 field.setText("");                 display.updateHand(rules.zoneList("hand"));                 display.updateDiscard(rules.zoneList("Discard")); // This is the error here! The discard Zone was empty!             }             else {                 field.setText("You do not have " + card.getName());                 field.selectAll();             }         }         else {             field.setText("That cardname is unused");             field.selectAll();         }     } } 
  • 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. 2026-05-10T23:10:11+00:00Added an answer on May 10, 2026 at 11:10 pm

    Welcome to the complexity of writing GUI code.

    When you run a Swing program, a background thread called the Event Dispatch Thread is created. When the user clicks on a JButton, for example, JButton creates and fires an event using this Event Dispatch Thread. Hence the name: it’s the thread that dispatches events!

    Your code:

    public void actionPerformed(ActionEvent e) {         String cmd = e.getActionCommand();         String name;  // more code... } 

    is called by this Event Dispatch Thread, so your code can handle the event.

    Somewhere within your code you are trying to do something with a variable that is currently equal to null. The error message is telling you, ‘hey while running some code on the event dispatch thread, I encountered a NullPointerException’ in your code.

    Why are you not receiving more info? Possibly you configured Eclipse not to include debug info when compiling?

    For now, I recommend adding some lines to your actionPerformed method to show the state of variables:

    System.out.println('field = ' + field); System.out.println('rules = ' + rules); System.out.println('display = ' + display); 

    See if this shows you any nulls.

    Even if the NullPointerException comes from a library, the stack trace will show which line of your code called that library. But only if you’ve configured Eclipse to generate debugging info.

    In the longer term, work through the Sun’s Swing Tutorial to learn more about these issues.

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

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer For others reference... You can set the FTB's ToolbarLayout property… May 11, 2026 at 12:44 pm
  • added an answer There's a TOOLSWITCH command in 9.1 but I don't think… May 11, 2026 at 12:44 pm
  • added an answer Up to a sign, the determinant of an n-by-n matrix… May 11, 2026 at 12:44 pm

Related Questions

ANSWER: If you ever see these lines and are mistified like I was, here's
For a C# UserControl on Windows Mobile (though please answer if you know it
What's the difference between TRUNCATE and DELETE in SQL? If your answer is platform
Is there a built in way to create round-cornered UILabels? If the answer is
I can't seem to find an answer to this problem, and I'm wondering if
I've seen a number of 'code metrics' related questions on SO lately, and have
This question is more or less programming language agnostic. However as I'm mostly into
Has someone ever measured performance of Sequential Guid vs. Standard Guid when used as
I went through a period of being interested in how quantum computers work and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.