0

I am using NetNeans I have a JPanel that is supposed to show some already input data along with a progress bar while the remainder of the program carries out some lengthy processing (about 1 minute long). Once the processing is done, this same JPanel is supposed to be updated with a few JTextFields containing the processed data. The issue: The JPanel shows up completely blank throughout the time period the processing is going on. Once the processing is done, then all the data shows up. Its baffling me. Here is how i've programmed it:

/*The parent class which calls the output JPanel
     *Lister is the output JPanel. The constructor calls initComponents(), and fills
     *text fields that contain the data that has already been input.
     *fillresult then triggers the processing function that takes a while. Once the
     *processing function is done, fillresult fills the processed data into the
     *respective Text Fields
     */
    ListWords = new Lister();
    System.out.println("l");
    ListWords.setVisible(true);
    ListWords.fillResult();

   //Lister constructor:
   Lister(){
         initComponents();
       MatchWords = new Matcher();//Matcher() only contains the initialization of a List

         jTextField1.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(0, 1));
         jTextField2.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(1, 2));
         jTextField3.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(2, 3));
         jTextField4.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(3, 4));
         jTextField5.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(4, 5));
         jTextField6.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(5, 6));
         jTextField7.setText(Scrabbulous.scrab.EntryWind.getCombo().substring(6));
   } 

   //fillresult():
 public void fillResult(){
    int rIndex = 0;
    MatchWords.makeWords(rIndex);
    while(MatchWords.realWords.Head == null && rIndex < 2){
        rIndex++;
        updateStatusBar();
        MatchWords.makeWords(rIndex);
    }
    Wordpoints = new String[MatchWords.realWords.getSize()];
    for(int i=0; i<Wordpoints.length; i++){
        Wordpoints[i] = "";
    }

    for(int i=0; i<MatchWords.realWords.getSize(); i++){
        int total = 0;
        for(int j=0; j<MatchWords.realWords.getNode(i).getWord().length(); j++){
            for(int k=0; k<Scrabbulous.scrab.scralphabet.length; k++){
                if(MatchWords.realWords.getNode(i).getWord().charAt(j) == Scrabbulous.scrab.scralphabet[k].getLetter()){
                    total += Scrabbulous.scrab.scralphabet[k].getValue();
                    Wordpoints[i] = ""+total;
                }
            }
        }
    }

    try{
        jTextField8.setText(MatchWords.realWords.Head.getWord());
        jTextField13.setText(Wordpoints[0]);
    }catch(NullPointerException e){
        jTextField8.setText("No Match Found");
        jTextField13.setText("-");
    }
    try{
        jTextField9.setText(MatchWords.realWords.getNode(1).getWord());
        jTextField14.setText(Wordpoints[1]);
    }catch(NullPointerException e){
        jTextField9.setText("No Match Found");
        jTextField14.setText("-");
    }
    try{
        jTextField10.setText(MatchWords.realWords.getNode(2).getWord());
        jTextField15.setText(Wordpoints[2]);
    }catch(NullPointerException e){
        jTextField10.setText("No Match Found");
        jTextField15.setText("-");
    }
    try{
        jTextField11.setText(MatchWords.realWords.getNode(3).getWord());
        jTextField16.setText(Wordpoints[3]);
    }catch(NullPointerException e){
        jTextField11.setText("No Match Found");
        jTextField16.setText("-");    
    }
    try{
        jTextField12.setText(MatchWords.realWords.getNode(4).getWord());
        jTextField17.setText(Wordpoints[4]);
    }catch(NullPointerException e){
        jTextField12.setText("No Match Found");
        jTextField17.setText("-");
    }

Could someone please be of assistance? Oh yes, and I read about adding a .refactor() and/or repaint(), but atleast the jForms initialized in the constructor should show up? :/ Also, it might be worth mentioning that all the code that is currently in the fillresult() function was initially in the constructor, and the output was displaying. However, since I want the progressbar here, I've shifted it to a new function. help please?

2
Contributors
1
Reply
12
Views
3 Years
Discussion Span
Last Post by JamesCherrill
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.