Dispatch « Thread « Java Swing Q&A





1. Is it safe to construct Swing/AWT widgets NOT on the Event Dispatch Thread?    stackoverflow.com

I've been integrating the Substance look and feel into my application and ran into several problems regarding it's internal EDT (Event Dispatch Thread) checking routines. Substance absolutely refuses to ...

2. Multiple Swing event-dispatch threads    stackoverflow.com

I would like to create a new event-dispatch thread in Swing, and I'm having trouble finding any references online for how to do this. I have done this in .NET ...

3. Passing data from GUI to event dispatch thread in Swing    stackoverflow.com

I am developing a Swing/Java app but having difficulties passing data from the initiliaser threads to one of the GUIs. The GUI is initialised by invoking an 'initComponents()' method on the ...

4. Confusion between whether a code should be executed by EDT (Event Dispatch Thread) or not?    stackoverflow.com

I had developed a Swing GUI which contains 12 JPanels. Initially, all the JPanels code was written in the main JFrame class code. As a result, the code became too long ...

5. How does the event dispatch thread work?    stackoverflow.com

With the help of people on stackoverflow I was able to get the following working code of the simples GUI countdown (it just displays a window counting down seconds). My ...

6. What is the event dispatching thread?    stackoverflow.com

I know what "thread" means and if I understand the event dispatching thread (EDT) as "just a thread", it explains a lot but, apparently, it does not explain everything. I do ...

7. Swing verify code on event dispatch thread at runtime    stackoverflow.com

Are there any libraries that instrument code to verify that methods called on swing components are called on the event dispatch thread? It probably wouldn't be too difficult to write some ...

8. How can I run all methods of a class on Event Dispatch Thread    stackoverflow.com

I've created a Swing component which has several methods.
Now I want all methods of this class be run on Event Dispatch Thread (EDT), while callers are on Worker threads. The only ...

9. Is doClick need to be on the dispatching thread?    stackoverflow.com

Is the AbstractButton.doClick need to be on dispatching thread ? If I look at the jdk 6 source I read :

   public void doClick(int pressTime) {
     ...





10. Where is the event dispatch thread called?    stackoverflow.com

I read that all the code which constructs Swing components and handles Events must be run by the Event Dispatch Thread. I understand how this is accomplished by using the SwingUtilities.invokeLater() ...

11. Java Threads -- Perpetual Loop in Swing Event Dispatch Thread    stackoverflow.com

I have a SwingWorker with the implementation:

public Void doInBackground() throws InterruptedException
{
     while (true)
     {
          ...

12. Measuring "busyness" of the event dispatching thread    stackoverflow.com

I would like to measure the "busyness" of my Event Dispatching Thread. One possible idea is to set up a background thread that does something like:

while(true) {
    final ...

13. How to wait until a task has finished and then continue, within the event dispatch thread?    stackoverflow.com

I have a program, a game, with GUI made with Swing. The GUI is comprised of my own class which inherits JFrame and holds a JPanel with CardLayout, which has multiple JPanels ...

14. Use of multiple threads in a Java program and vs need to create Swing objects on EDT    stackoverflow.com

Re: Requirement to create Swing Object on Event-Dispatch Thread. I am working on an application, the purpose of which is to monitor and display the condition of various remote embedded servers. I'm ...

15. Is there a clean way to retrieve the AWT event dispatch thread    stackoverflow.com

I'm trying to do some monitoring of the AWT Event Dispatch Thread's (EDT) health from a separate thread. If I start missing heartbeats I want to dump the EDT stack ...

16. Java Swing: Event-Dispatching Thread VS Stopwatch    stackoverflow.com

I have a java program with a GUI based on Swing. In the main class there are some computations which are grouped in a separate thread. My problem is : I ...





17. Java Swing - How to run two components in Event dispatch thread at the same time?    stackoverflow.com

I have a JButton that when i click on it, i load some data from a database + initialize a JDialog that has many controls + fill those controls with the ...

18. Simulating the Event Dispatch Thread    stackoverflow.com

In my application I'd like to forward mouse and keyboard events to an invisible JPanel and I'd like that JPanel to process them as if they came from the EDT. The ...

19. Detecting that JVM is shutting down    stackoverflow.com

I have a Swing application that handles Ctrl+C using addShutdownHook(), and it works fine until one of the shutdown tasks I have calls a function that under normal circumstances changes a ...

20. Java Event-Dispatching Thread explanation    stackoverflow.com

I've recently started learning and exploring the basics of GUI programming in Java. Having been programming for a while I have only done backend work or work and as a result the ...

21. Multiple Event Dispatch Threads    stackoverflow.com

I am new to Java Swing and my question is related to Event Queues and Dispatch threads. I read that it is possible to have multiple event queues , each per

22. Understanding the scope of code evoked in the Java Event Dispatch Thread    stackoverflow.com

I'm trying to understand which events will be managed from an event disptach thread (EDT). Let's assume something simple, a simple piece of code that simple opens a JOptionPane, waits ...

23. Running function on EDT from doInBackground    stackoverflow.com

I want to run a certain function from doInBackground on the EDT. I have it currently setup using publish and process which is working just fine. However, I want to know ...

24. Eclipse/Java: uncaught exceptions on the EDT suspend execution in EventDispatchThread.run()    stackoverflow.com

This is a minor annoyance I have when debugging with Eclipse. With "Suspend execution on uncaught exceptions" checked, the debugger will normally suspend a thread right where the exception was thrown. ...

25. How do you use the Event Dispatch Thread?    stackoverflow.com

I've been programming stuff in Java for almost a year now, and a few months ago I learned about how swing isn't thread-safe. Delving deeper, I discovered that every modification to ...

26. Why do I need to have a runnable instead of calling directly from main?    stackoverflow.com

Simple code from java.sun:

public class BasicApp implements Runnable {

    JFrame mainFrame;
    JLabel label;

    public void run() {
      ...

27. java SwingWorker launching runnables from doInBackground() and howto notify event dispatch thread    stackoverflow.com

just learnd the SwingWorker and have a question
( i have search for a answer to this but non specifically address this setup) Im creating a small server that will have like max ...

28. Effective use of the Swing Event Dispatch Thread - issue with code to look at    forums.netbeans.org

I've opened a new issue to focus the discussion an development of a new API for netbeans that will hopefully start to focus developer activities, when processing actions into a simple ...

29. Event Dispatching thread.    coderanch.com

30. Event Dispatching thread    coderanch.com

It's a tough concept. Basically, most of what you do to change a GUI is based on a user poking at it, e.g., the user pokes a button, and you turn all the cells in a table rainbow colors. That kind of thing you don't have to worry about because all the calls you make come from event handlers, which are ...

31. Waiting the Event-Dispatch thread    coderanch.com

Hi, I want to write a single threaded application with a GUI. I'm writing for a limited environment and context switches and synchronization are very expensive. I need to provide a little background before I get to my question. I'm using just simple low level graphics calls and no widgets nor peer code. Given that I need to use one thread, ...

32. problems with event-dispatching thread in AWT    coderanch.com

I'm trying to get something done within a AWTEvent (actionPerformed). In my environment I can't use swing so I have to solve this problem in AWT (jdk-1_1_8_006). This something is running a new frame (screen) with a lots of new AWTEvents and also a database interaction. I seem to have problems with painting the new screen within the first AWTEvent. I ...

33. dispatch thread not able to run    coderanch.com

Unfortunately I don't have a sample program to include to illustrate, but.. Basically, we have a gui that is running an exec as part of a process. The process passes information back and should be displayed as an updating label on the UI. The swing thread isn't running until the exec is finished, then handles all the updates all at once. ...

34. event-dispatching thread    coderanch.com

Originally posted by Niyas Ahmed Sheikh: Hi, While I am practising some swing examples, I had come across the word "event-dispatching thread". What it is mean? here is the explanation from SUN. Here's the Single Thread Rule: Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in ...

35. Interacting with dispatch thread    coderanch.com

Hi guys, I am developing an app that has 2 different GUIs but having difficulties passing data from the initiliaser threads to the GUIs. The 1st GUI (MessageDisplay) is initiliased by a thread on receipt of a UDP packet: while (true) { // blocks until message received clientsock.receive(packet); // create new MessageDisplay to show any incoming messages Runnable msgdisp = new ...

36. event dispatching thread    coderanch.com

thanks. follow up a design question: if we need to put every gui update on the event dispatching thread, would this be a performance issue. for example, if one component in the gui receives 10-20 updates every second and other components are updated through user's actions. in this case, should we seperate these 2 type of updates for better performance?

37. What happens to events when an actionlistener is hogging the event dispatch thread    coderanch.com

Hi, This is probably a really dumb question, but I'd appreciate any help: I'm just curious. If I have an actionlistener which is executing its actionPerformed inside the AWT event dispatch thread (i.e. we haven't done the correct thing of either doing the work in a new thread so it doesn't hog the event dispatch thread, or doing the work in ...

38. event dispatch thread    coderanch.com

39. Event Dispatch Thread    coderanch.com

Hi everyone, I have gone through regarding thread & swing components.I have got to know that most of the event are being handling by the event dispatch thread.So my question is this, When I create GUI inside main method, does all event handling occurs in the main thread with no help of event dispatch thread or . does main method implicitly ...

40. retrieving event dispatch thread    coderanch.com

Hi Java Ranchers! I have two threads. The first one compute some tasks and after that it call Event Dispatch Thread to present that task. Event Dispatch Thread do it, but the computations thread do another computations and Event Dispatch Thread is too slow to present the data. EventQueue.invokeLater(new Runnable(){ public void run(){ //complex GUI update, based on the calculations from ...

42. Event dispatch thread    coderanch.com

I assume you are referring to code you would put in your TestFr constructor. No, this will be run by the main thread, not by the EDT. However, this is not a problem. As long as you haven't started up the EDT (which you do through the first call to pack() or setVisible() on a JFrame) you can call any methods ...