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
1 answer

Java GUI getting hanged before networking

I am developing a game in Java. In the server side,at one place i change the gui before sending the info to the clients. When i run it without the networking part(Tag 1 in the code),it runs good.But when i do networking part(take note it is done…
0
votes
2 answers

Button color Issue in Linux platform

The Button color is not getting updated rather didn't show normally as well as dynamically when i run my application. this problem occurs only on Linux environment and the same code work fine with windows. private JButton button = new JButton(); …
user1280096
  • 137
  • 1
  • 1
  • 9
0
votes
1 answer

Search function with 2 JComboBox - searching with 1st the 2nd is not displayed

It runs fine but when choosing the idCombo with which I'm searching, the nameFIeld which is also a JComboBox does not change but remains the first in the list, while all other fields change accord. package GUI; import Logic.*; //Inherits from…
John
  • 1
  • 1
0
votes
2 answers

Not able to repaint inside the Jframe/label

Basically, there are two different BufferedImage called img_w and img_b1... Once I set my Jframe/label to one of them, it never changes or never repants() to the new Imagebuffered value... Thanks in advance.. BufferedImage img_w = new…
JS_VIPER
  • 141
  • 1
  • 2
  • 7
0
votes
2 answers

Splash Screen Progress bar not drawing

I'm trying to make my own progress bar, on my splash screen. Creating my splash screen was easy: java -splash:EaseMailMain.jpg Main.class (From Eclipse) The first line of my main method calls this: new Thread(new Splash()).start(); And this is…
Adude11
  • 605
  • 5
  • 16
0
votes
1 answer

JTree nullpointer loading first row

I'm trying to select the first row on a JTree when i create it. But sometimes i get the following exception: java.lang.NullPointerException at javax.swing.plaf.basic.BasicTreeUI.completeEditing(BasicTreeUI.java:2035) at…
0
votes
3 answers

Why is the painting of a component delayed?

I want to paint a panel blue, then wait five seconds, then do other stuff. Now I have the following piece of code, which I expect to do what I want. Here it is: JPanel somePanel = getSomePanel(); somePanel.setBackground(Color.BLUE); Object lock =…
MC Emperor
  • 22,334
  • 15
  • 80
  • 130
0
votes
1 answer

Event Dispatch Thread in GWT?

When writing Swing or AWT applications, I'm aware that GUI changes should always be done in the EDT. How does this translate to writing GWT applications? I'm looking at a scenario when I call the…
Will
  • 2,858
  • 6
  • 33
  • 50
0
votes
1 answer

How to settle an an image in Applet for tetris game

I developing tetris game using applets. I have generated random shapes and making it move. But i don't know how to make it settle at the bottom. My shapes are vanishing once it reaches the end of the screen. Please help me on this regard. Here goes…
0
votes
5 answers

Java: Updating UI while waiting for another thread to finish

I have some Java Swing login panel. When user click "login" button, extensive DB communication takes place. I got an idea to put that db communication into another thread (that db communication is used for filling some hash maps and singletons).…
guest86
  • 2,894
  • 8
  • 49
  • 72
0
votes
2 answers

JTable - UI freezes upon many insertions

I have a GUI app which has a couple of tabs, each of which hosts one JTable. My UI class i processing events coming from the Controller in the following piece of code, which runs on EDT: private void processAnalysisResult(AnalysisResult…
Bober02
  • 15,034
  • 31
  • 92
  • 178
0
votes
0 answers

Updating a java jframe

I am trying to update the text in a jtextarea stored in a class I created with the netbeans GUI tool. In my server class I have the following code.... window is the name of the object instance Message message = (Message)…
Chris Headleand
  • 6,003
  • 16
  • 51
  • 69
0
votes
1 answer

Animating JDialog

I created a JDialog which I want to move and resize. My program draws JDialog on the screen. When the user clicks it, it should stretch to the width of the screen and then gain height. I tried it like this. for(int i = 150; i <= width; i += 3) { …
MikkoP
  • 4,864
  • 16
  • 58
  • 106
0
votes
3 answers

Dynamically change JLabel with Ping Results

I want to change a JLabel dynamically with each new string produced by a simple Ping but can't figure out how to replace the existing string on the JLabel with each new string coming in as the Ping is executing. Below is what I have so far. So far…
user1524652
  • 41
  • 1
  • 4
0
votes
1 answer

JTree async node creation is not consistent with JGraph library

I am creating a Jtree with a rootNode and than create another thread that update the root node asynchronously. It works fantastic if i run this Jtree independently in some JPanel, it was even working at some place in the project, but i was asked to…
leoismyname
  • 407
  • 6
  • 11