I want to ask how to give jProgressBar in my code. i used netbeans interface. progressBar will end after it reach maximum_iteration. jProgressBar already in other class. how can i fix it? Thank you. Please help.
train() is placed in other class.
public void train(){
for(int iteration=0; iteration<this.max_iteration; iteration++){
//int percent = (iteration/this.max_iteration) * 100;
//cs.jProgressBar1.setValue(percent);
for(int index=0; index<this.hms; index++){
Node[] newChord = {};
double random = Math.random();
/*process HS*/
if(this.original_chord != null){
// ensure the fist note of the new chord is not altered
newChord[0].notes = new int[first_chord_notes.length];
for(int j=0; j<first_chord_notes.length; j++){
newChord[0].notes[j] = first_chord_notes[j];
}
}
// evaluate new chord and substitute the worst one in hs if new chord is better
double newFitness = this.nodeListFitness(this.original_chord, newChord);
int worstIndex = this.worst_index();
double worstFitness = this.fitness[worstIndex];
if(newFitness > worstFitness){
this.hm[worstIndex] = newChord;
this.fitness[worstIndex] = newFitness;
}
}
System.out.println("Harmony Memory " + (iteration+1));
this.debug();
System.out.println("");
//JProgressBar jProgressBar1 = new JProgressBar();
//cs.jProgressBar1.setValue(iteration);
//cs.jProgressBar1.setEnabled(true);
}
}