Sorry for being a bit incomprehensible in my last few posts, I was on a streak of human uptime, with a dangerously low supply of caffeine. What I didn't notice in my sleepy haze is that yes, I was previously trying to use this swing worker thread, and appeared to be having difficulty making it work. I'm gonna lay down some pseudo-code to see if you might have a suggestion or two.
//Set up GUI and various other parts of the program already, but this part doesn't seem to work
public class UpdateTime extends SwingWorker<Void, Integer>{
protected Void doInBackground() {
while(true){
//I want this to happen always
try{
gui.updateTimeLbl(gui.lblTime, pollPath, homePath);
//the updateTimeLbl updates the jLabel at gui.lblTime, using the data gotten from a file located in homePath, which is generated by a small shell script located at pollPath
//the method polls Pianobar first, and the script outputs the song title and time info to a file, which is used by both updateTimeLbl and updateSongLbl
//the method then updates the specified jLabel with the information it got from the file
gui.updateSongLbl(gui.lblNowPlaying, homepath);
} catch (IOException e1) {
e1.printStackTrace();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
//Using some high-tech debugging skillz (System.out.println("TEST");), I can determine that the execution never reaches this point in code, and I think I had given up before I bothered to figure out why
return null;
}
}
}
public void doTask(){
UpdateTime time = new UpdateTime();
time.execute();
}
So, aside from the flak I'm sure I'm going to catch from using a shell script to poll the program for parameters, and my glorious handling of exceptions, can you see any reason why this shouldn't work?