473,320 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to add time event to show jframe component one after another?

I want to create the visual expression of merge sort to explain it.

So what I want is first in textbox initial sequence of number. And the subsequently next state with some time delay sequentially.

Can any one tell me how to do.
I tried by creating Thread like:

Expand|Select|Wrap|Line Numbers
  1. PrimeThread p = new PrimeThread();
  2.             p.start();
  3.             jTextField1.setVisible(false);
  4.             jTextField2.setVisible(false);
  5.             p.sleep(1000);
  6.             jTextField1.setVisible(true);
  7.             p.sleep(2000);
  8.             jTextField2.setVisible(true);
but this does not work. All of them appearing at same moment!
Jan 14 '13 #1
1 1777
Anas Mosaad
185 128KB
Sleep method is static. Which means when you call p.sleep, you are not sleeping p thread. You are sleeping the current thread. That's why you are unable to see the changes.

You will need to update the UI from the thread using SwingUtilities.invokeAndWait. May be this article will help you http://www.cab.u-szeged.hu/WWW/java/...g/threads.html.
Jan 14 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Andreas | last post by:
Hi! Is it possible to get a time event at a specific time, for instance eight a'clock? My program is running in the background and is minimized to the tray bar. If not, is there a smooth way...
1
by: Scott Holmes | last post by:
I'm experiencing what seems to be strange behaviour. I don't know if it's Pmw, Tkinter on Python. I have a button, defined in a Pmw.buttonbox, that I would like to configure to "sunken" after it...
2
by: Paolo Dupont | last post by:
I need to instantiate a component on a remote server. I did it easily. However, i can not set the handler for the event associated with the class. I'm able to implement and use events only if the...
1
by: agro_r | last post by:
I use this code in my program: while(form.Created) { form.CheckTime(); Application.DoEvents(); }
2
by: Dave Dessex | last post by:
Basically we have a system in place that moves files around and reads them in and so forth. I want to build a web app that will have the ability to track every business events real time as they...
9
by: Andreas Lundgren | last post by:
Hi! Is it possible to get a time event at a specific time, for instance eight a'clock? My program is running in the background and is minimized to the tray bar. If not, is there a smooth way...
0
by: davidcm | last post by:
I inherited a Visual Basic application. I made some changes to it and put the .exe back out on the shared server where it runs. Some users run just fine. But some users are seeing the following...
1
by: rmohanrao | last post by:
Hi All, I have copied a project from production system to my system, to test the project. When I run the project it is giving the error "Run-time error '429': ActiveX component can't create object"....
1
by: adeebraza | last post by:
Hi, Every Body Following is code for Showing Actual Date & Time on the form and also record Date & Time of an event. See the following and use Call Modified when you want to record an event in...
1
by: suchetapatra | last post by:
add two number and show result in another browser window. in javascript
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.