制作一个转换程序,如果语句“#”和“期待和我的jlabel setText不工作..一堆错误

时间:2015-06-05 12:59:27

标签: if-statement jlabel settext

好的,所以我拿出了刚刚标记它们的开头..它在我的if else语句附近和我的settext语句中保持错误?说")" if的预期和非法开始表达。我对此感到陌生并感到困惑,任何帮助都会受到赞赏。另外,为此,我应该使用参数,我得到的教训几乎没有解释那是什么..所以任何帮助..谢谢

    inches = Double.parseDouble(jTextField2.getText()); // get txt from txtfield to show te value
     feet = Double.parseDouble(jTextField2.getText());
     yards = Double.parseDouble(jTextField2.getText());
      metres = Double.parseDouble(jTextField2.getText());
    //choose conversions 1-4
    //conv1
     String textfieldinput = jTextField1.getText(); //getting txt and making it check if equal

    if(textfieldinput.equals("1"))
    centimetres = inches*2.54;
    jLabel8.setText( inches + "inches" + " = " + inches*2.54 "cm");

    //conv2
     if else (textfieldinput.equals("2")) 
    centimetres = feet*30;
    jLabel8.setText(feet + "feet" + " = " + feet*30 "cm");

    //conv3
     if else (textfieldinput.equals("3"))
           metres = yards*0.91;
      jLabel8.setText(yards + "yards" + " = " + yards*0.91 "metres");
    //conv4
     if else (textfieldinput.equals("4"))
          kilometres = metres*1.6;
 jLabel8.setText(metres "metres" + " = " + metres*1.6 "km");

0 个答案:

没有答案