Questions tagged [event-dispatch-thread]

The event dispatch thread, or EDT, is a special background thread which handles events from the Java GUI event queue. Swing and Android have different implementations but they are similar in concept.

This thread must never be stalled with some computationally intensive or otherwise slow task (like networking), as the GUI stops responding to user input until the call returns.

As Java GUI environments are not thread-safe, it is the only thread that can safely touch GUI components (instantiating and updating GUI components, including setting values for text fields and the like). If any other thread must do this, this should be done through a wrapper method that runs on the EDT. In Swing, the wrapper method is SwingUtilities.invokeAndWait or SwingUtilities.invokeLater. In Android, Activity.runOnUiThread serves the same purpose.

775 questions
0
votes
5 answers

can anyone help me with why my GUI is un clickable while the loop is running?

after the loop is finished all buttons and textfields are useable, but while the loop is running nothing can be clicked. i have tried lots of different things, looked on lots of different sites but nothing can help me. i cant find out what is…
JAVA
  • 29
  • 5
0
votes
2 answers

Implement StopWatch

Could anyone explain why my start/stop button doesn't work please? This is not a full implemented StopWatch but I got stuck here. Any help is appreciated! This is my first time posting question in forum so if there is any problem in my post, please…
0
votes
1 answer

jtable update data not visible

I am running into a problem similar to what I have read here about inserted data and added data not showing up on jtable. I have tried repaint() and revalidate(), but to no avail. Basically, I have two classes say A and B. A calls a function in…
0
votes
1 answer

in Jython, is there a Pythonesque way of submitting a method to the EDT?

In Python one is used to doing def runTaskInNonEDT(): pass tRunTask = threading.Thread( target = runTaskInNonEDT ) tRunTask.start() In Jython, I find that if I want to submit a method to the EDT I have to go def makeRunnableClass(): class…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
0
votes
1 answer

JFrame only refreshed when a method ends

I'm developing a game using Netbeans, but now I am stuck. Inside the main JFrame class, I have developed some methods, each of them have have many lines in which for example, the icons of components contained by the frame change. The issue is that I…
user1454456
  • 51
  • 1
  • 7
0
votes
3 answers

Class not found when using SwingUtilities.invokeLater in OSGi Bundle

(EDIT: Problem is solved - see details at the end) I want to create a Swing JFrame with a WindowAdapter in an OSGi Bundle. When I do this using SwingUtilities.invokeLater, the WindowAdapter class is not found. Without invokeLater it works. What do…
Rainer Schwarze
  • 4,725
  • 1
  • 27
  • 49
0
votes
2 answers

create new thread inside actionPerformed and Event Dispatch Thread (EDT) issue

As stated from Sun that actionPerformed() from ActionListener is executed in EDT automatically so I've decided to create new thread inside actionPerformed() method and the problem is this thread is not running inside EDT. Can someone explain this?…
MinhHoang
  • 681
  • 3
  • 9
  • 22
-1
votes
3 answers

Swing window doesn't appear after getting input from Console

I have a simple swing window in order to load files. This appear in the class analyzedLoad, in a function analyzedloads() JFileChooser fc = new JFileChooser(); JFrame frame = new JFrame(); int returnVal =…
Adam Sh
  • 8,137
  • 22
  • 60
  • 75
-1
votes
1 answer

JProgressBar from Oracle

I've downloaded a small Java project from oracle website to create a progress bar. I understand it, but I need to apply it in a different way, the application is creating a thread in the background so the progress bar can be updated accordingly…
JAVADEV
  • 51
  • 6
-1
votes
1 answer

Jframe form setVisiblity(true) is having effect after method termination

I am creating an object of Downloader JFrame class in the constructor of the main form and calling its setVisiblity(true) method on download button click. The problem is Downloader frame is showing but when the method has termininated: Downloading…
-1
votes
1 answer

jLabel not changing text and jProgressbar not updating

I have a JFrame. in the JFrame is a JDesktopPane, JComboBox, several JLabels, and a JProgressBar. I am facing two challenges: I want to update/change the text in one of the JLabels in the JFrame by clicking a JButton that is on a JInternalFrame…
hybee
  • 1
  • 1
-1
votes
1 answer

JFrame popup not showing content

I have ClassA that does some processing and I want it to create a popup Jframe ClassB that shows some statistics that ClassA calculated. So I did something like this: public class MainMenu extends javax.swing.JFrame { public MainMenu() { …
Pokopik
  • 23
  • 3
-1
votes
1 answer

Send button doesn't work in Chat server app

Okay, I know there are a lot of similar questions here, but i couldn't find out my problem by going through them. So i have to post this.Sorry for that guys. Here is my prob... I made a chat server that worked on netbeans console for output a few…
Kirty Bhushan
  • 147
  • 2
  • 12
-1
votes
1 answer

Swings jLabels doesn't update even though I'm using threads

I'm writing a little joke-app for a friend of mine and I just can't figure why my labels are not upating and the GUI frozes. I understand that I have to use threads for the background operations in order to keep using the GUI, but it's freezing even…
Deses
  • 1,074
  • 2
  • 12
  • 25
-1
votes
2 answers

JButton: actionPerformed while invisible/disabled?

Is it possible that, for example, a JButton calls actionPerformed() of an ActionListener attached to it while the button itself is hidden or has been disabled? Like, the user clicks the button, an event gets added to the Event Queue, and in a…
AyCe
  • 727
  • 2
  • 11
  • 30