title: How to display a "Loading..." message that closes automatically when processing is over (similar to Progress Bar)?
body: <p>I have a comboBox jComboBox1 that contains names of all countries in the world...Upon selection of one of the countries a second combobox jComboBox2 is populated with all the states in the country selected in jComboBox1.  Now I want to display a Progress Bar or "Loading..." message when the states in the selected country is populated and closes automatically once it's done.</p>
  
  <p>The code is like this...</p>
  
  <pre><code> public void actionPerformed(ActionEvent e){
      if(e.getSource()==jComboBox1){
              if(jCombobox1.setSelectedIndex()!=-1){
                     Country country=new Country();
                     country.populateStates(jComboBox2,label,this);
                    //"label" is of type JLabel whose text is is set to show the progress
                    //"this" refers to the current frame to repaint once label is changed
              }
      }
   }
  </code></pre>
  
  <p>I thought I can use a JLabel in the frame whose visibilty and text can be set using setVisible() and setText. Note that "Country" is a different class and I pass this label to its method populateStates where I use label.setText("Loading details of state:"+state) and do frame.repaint(). (That's why I pass the frame object "this").  Even then, label does not change.</p>
  
  <p>But the only change that appears in the label's initial text after selection of a country is the last text that it is set to, once country's selection is over.  Intermediate changes in the label do not appear in the GUI. Why's this happening and what's wrong with my approach?  Do I have to use another approach using threads??? If so, how??</p>