title: Button continuously shows pressed status and can't display the result
body: <p>Below is my action class,the program can run, but sometimes when you pressed the button, it continuously shows pressed status,and the result can't display in the <code>JTextField</code>?</p>
  
  <pre><code>    public class SsqAction implements ActionListener{
  
      String luckNum="";
      private JTextField luckField;
  
      public SsqAction(JTextField luckField){
          this.luckField=luckField;
      }
  
      public void actionPerformed(ActionEvent event){
          int[] a={0,0,0,0,0,0,0};
          int tag=0;
  
          for(int k=0;k&lt;6;){
  
              double i=Math.random()*33;
              int temp=(int)Math.ceil(i);
              a[k]=temp;
              for(int j=0;j&lt;k;j++){
                  if(a[j]==a[k]){
                      tag=1;
                      break;
                  }
              }
              if(tag==0){
                  k++;
              }
  
          }
  
          double j=Math.random()*16;
          int b=(int)Math.ceil(j);
          a[6]=b;
  
          for(int i=0;i&lt;7;i++){
              luckNum=luckNum+a[i]+" ";
          }
  
          luckField.setText(luckNum);
  
      }
  
  }
  </code></pre>