带标签的非法转发引用



我遇到麻烦了…

不像我的上一篇文章,我已经谷歌了,没有任何帮助。

为什么我在这里得到:非法的前向引用错误,我该如何去修复它?

   public class guihanging extends javax.swing.JFrame {
 int re;
 String [] A = new String[10];
 String word;
 String dash = "";
 int picture = 2;
 String letter = "qw";
 int startOver;
 int qq=0;
 int ww=0;
 int ee=0;
 int rr=0;
 int tt=0;
 int yy=0;
 int uu=0;
 int ii=0;
 int oo=0;
 int pp=0;
 int aa=0;
 int ss=0; 
 int dd=0;
 int ff=0;
 int gg=0;
 int hh=0;
 int jj=0;
 int kk=0;
 int ll=0;
 int zz=0;
 int xx=0;
 int cc=0;
 int vv=0;
 int bb=0;
 int nn=0;
 int mm=0;


public guihanging() {
    initComponents();
    { 
       A[0]="rob";
       A[1]= "welcome";
       A[2]= "carbohydrates";
       A[3]= "resiprocity"; 
       A[4]="fatty";
       A[5]="baggy";
       A[6]="laptop";
       A[7]="personalcomputer";
       A[8]="monitor";
       A[9]="mouse";
     }
}
public void letters()
{System.out.println("");}
{
 int wordleng = word.length();
    for (int i2 = 0; i2 < wordleng; i2++) 
    {
      int position = word.indexOf(letter);
      if (position >= 0)
      {
         String before = word.substring(0,position);
         String after = word.substring(position+1);
         word = before + "@" + after; 
         int dashPosition = position * 2;
         String dashBefore = dash.substring(0,dashPosition);
         String dashAfter = dash.substring(dashPosition + 1);
         dash = dashBefore + letter + dashAfter;
         lblWord.setText(dash);//error
      }
      else 
      {
         lblPicture.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pictures/"+picture+".png")));// error
         picture++;
         if (picture == 7)
         {
             JOptionPane.showConfirmDialog(rootPane, "Unluck, You just did a burpee!!"+"/n"+"do you want to start again?");
             if (true)
             {
               re = (int) (Math.random ()*10);
               word = "aaabcqdefghiqjklmnopqrstuvwxyz"; //A[re];
               for (int i1 = 0; wordleng < 10; i1++) 
                  {
                     dash = dash + "_ ";
                  }
              lblWord.setText(dash);/error
            }
         }
      }
    }
}    

错误都在标签

EDIT LEFT THIS OUT

  private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {                                         

    re = (int) (Math.random ()*10);
    word = A[re];
    int wordleng = word.length();
    for (int i1 = 0; i1 < wordleng; i1++) 
    {
       dash = dash + "_ ";
    }
    lblWord.setText(dash)

"非法前向引用"意味着您使用了未定义的变量。也许您错过了定义变量:dashlblWord ?

相关内容

  • 没有找到相关文章

最新更新