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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:58:38+00:00 2026-05-26T08:58:38+00:00

1.Consider my code is on some line of a JPanel that I have, am

  • 0

1.Consider my code is on some line of a JPanel that I have, am I automatically on EDT?

2.Same question for all other classes which are not belong to GUI, JPanels or other view classes, simple logical class.

3.If I have JPanel which I’m playing music while being in it, should the music run on event dispatch thread or on other thread which is not EDT (for not blocking the GUI, although I didn’t feel any problem with running it from EDT)?

Note: I want a general rule how to know it without using the SwingUtilities.isEventDispatchThread()
Thanks

  • 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-26T08:58:39+00:00Added an answer on May 26, 2026 at 8:58 am
    1. No.
    2. No.
    3. Background thread.

    If code running outside the EDT calls a method defined in a GUI class, that code will not be run on the EDT but in the calling thread.

    If code running in the EDT calls code defined in a non-GUI class, that code will run on the EDT.

    The rule is that if you’re not creating a different thread, the method you’re calling will run on the thread the calling code is running from – threads do not correspond to what classes methods are defined in.

    Methods that will run on the EDT are event listeners, when they’re called by Swing – not by you. (They still might be if you’re calling them from the EDT though.)

    Also, any code inside the Runnable.run() method passed to SwingUtilities.invokeLater() and invokeAndWait() is also run on the EDT.

    Any normal methods you call from the EDT will run on the EDT.

    Any code called from a Thread you create (whether using threads directly, or ExecutorService, or SwingWorker.doInBackground()) is not on the EDT. Your program’s main() method is also not on the EDT.

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

Sidebar

Related Questions

Tidying up some code that has what I consider to be a confusing line
I'm cleaning up some script errors and have a delicate dilemma. Consider this line
I have been encountering errors in Perl code that are reported at places which
I have a piece of code for some validation logic, which in generalized for
Consider this code: const char* someFun() { // ... some stuff return Some text!!
Consider the following code: std::string my_error_string = Some error message; // ... throw std::runtime_error(std::string(Error:
Don't they both have to convert to machine code at some point to execute
I have a problem with some C code I am writing as part of
Consider the following code. I am starting with a task that does nothing, and
Consider the following two trivial models: class Iq def score #Some Irrelevant Code end

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.