The Artima Developer Community
Sponsored Link

Java Answers Forum
Runtime.exec GUI

1 reply on 1 page. Most recent reply: Jun 2, 2003 1:40 PM by zenykx

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Wouter De Raeve

Posts: 1
Nickname: daxie
Registered: Jun, 2003

Runtime.exec GUI Posted: Jun 2, 2003 5:20 AM
Reply to this message Reply
Advertisement
Hello,

I have built a gui around a stand-alone executable, which is an image processing algorithm, which should be run let us say 10 times, on different images.

Thus when pressing let us say the start-button, the program should be executed.

I can do this by Runtime.getRuntime().exec("thealgo.exe");

This works fine, since the results of the algorithm are succesfully written to disc. Also reading in these results for later use works correctly as well.

Yet I would like to update some parts of my gui, for example putting a label like "processing" or showing the current image being processed.

Yet this doesn't work!! The gui is only updated when all processing is finished, thus only when the loop is finished!!

To show what the problem is:

for (int i=0;i<10;i++)
{
try
{
Runtime runtime = Runtime.getRuntime();
String [] toRun={"cmd.exe","start","NBSinVis.exe"};
Process process = runtime.exec(toRun);
process.waitFor();
runtime.freeMemory();
returnVal = process.exitValue();
process.destroy();
}
catch (IOException ioe)
{
System.out.println(ioe);
}
catch (InterruptedException ie)
{
System.out.println(ie);
}
jLabel.setText("the new text " + i);
}

Yet in this case only the last time the label would be updated.

Any ideas??

Thank you in advance


zenykx

Posts: 69
Nickname: zenykx
Registered: May, 2003

Re: Runtime.exec GUI Posted: Jun 2, 2003 1:40 PM
Reply to this message Reply
i think you must use another thread for the processing while the main thread to keep on redrawing the gui (make the progress bar, or what you want)

Flat View: This topic has 1 reply on 1 page
Topic: Searching Java editors develloped in java Previous Topic   Next Topic Topic: Frequency String function help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use