错误我无法弄清楚

时间:2013-10-31 12:48:30

标签: java

好的,所以我不确定为什么这个程序不起作用我在学校正在研究这个项目并且未完成但是现在每当我尝试运行它时我都会收到错误消息

  

线程“main”中的异常java.lang.Error:未解析的编译   问题:在Means34.main(Means34.java:96)

即使我删除了代码行,所以没有第96行,我仍然会收到此消息。任何人都可以告诉我为什么会这样吗?

import java.awt.*;
import BreezyGUI.*;

public class Means34 extends GBFrame{
    public Means34(){
        setTitle("Draw + means");
        red.setBackground(Color.red);
        green.setBackground(Color.green);
        pink.setBackground(Color.pink);
        blue.setBackground(Color.blue);
        magenta.setBackground(Color.magenta);
        cyan.setBackground(Color.cyan);
    }
    static Frame frm;
    Label firstNumLabel = addLabel ("Input: First Num",1,1,1,1);
    DoubleField firstNumField= addDoubleField (0,1,2,1,1);
    Label secondNumLabel = addLabel ("Input: Second Num",2,1,1,1);
    DoubleField secondNumField = addDoubleField (0,2,2,1,1);
    Label arithmeticLabel = addLabel ("Output: Arithmetic",3,1,1,1);
    DoubleField arithmeticField= addDoubleField (0,3,2,1,1);
    Label harmonicLabel = addLabel ("Output: Harmonic",4,1,1,1);
    DoubleField harmonicField= addDoubleField (0,4,2,1,1);
    Label geometricLabel = addLabel ("Output: Geometric",5,1,1,1);
    DoubleField geometricField= addDoubleField (0,5,2,1,1);
    Button convertButton= addButton ("Find Means",6,1,1,1);
    Button clearButton= addButton ("Clear",6,2,1,1);
    Label coll1Label = addLabel ("Color 1",7,1,1,1);
    Label coll2Label = addLabel ("Color 2",7,2,1,1);
    Label col1Label = addLabel ("               ",8,1,1,1);
    Label col2Label = addLabel ("               ",8,2,1,1);
    Label meancoll=addLabel ("Mean Color",7,3,1,1);
    Label meancol=addLabel ("               ",8,3,1,1);
    Button red = addButton ("               ",1,3,1,1);
    Button green = addButton ("               ",2,3,1,1);
    Button pink = addButton ("               ",3,3,1,1);
    Button blue = addButton ("               ",4,3,1,1);
    Button magenta = addButton ("              ",5,3,1,1);
    Button cyan = addButton ("               ",6,3,1,1);
    Checkbox colorone= addCheckbox("Choose first color",4,4,1,1);
    Checkbox colortwo= addCheckbox("Choose second color",5,4,1,1);



    double first;
    double second;
    double arithmetic;
    double harmonic;
    double geometric;
    Color meancolor;



    public  void colorer(Checkbox check, Button buttonObj, Button butt, Label labal, Color coler){
        if (check.getState()){
            if (buttonObj==butt){
                labal.setBackground(coler);
            }
        }
    }

    public void buttonClicked (Button buttonObj) {
        colorer(colorone, buttonObj,cyan,col1Label,Color.cyan);
        colorer(colorone, buttonObj,red,col1Label,Color.red);
        colorer(colorone, buttonObj,green,col1Label,Color.green);
        colorer(colorone, buttonObj,pink,col1Label,Color.pink);
        colorer(colorone, buttonObj,blue,col1Label,Color.blue);
        colorer(colorone, buttonObj,magenta,col1Label,Color.magenta);
        colorer(colortwo, buttonObj,cyan,col2Label,Color.cyan);
        colorer(colortwo, buttonObj,red,col2Label,Color.red);
        colorer(colortwo, buttonObj,green,col2Label,Color.green);
        colorer(colortwo, buttonObj,pink,col2Label,Color.pink);
        colorer(colortwo, buttonObj,blue,col2Label,Color.blue);
        colorer(colortwo, buttonObj,magenta,col2Label,Color.magenta);
        if (buttonObj==convertButton){
            first=firstNumField.getNumber();
            second=secondNumField.getNumber();
            arithmetic= (first + second)/2 ;
            harmonic= ((1/first) + (1/second))/2;
            geometric= Math.sqrt((first*second)) ;
            arithmeticField.setNumber(arithmetic);
            harmonicField.setNumber(harmonic);
            geometricField.setNumber(geometric);
            frm.revalidate();
        }
    }

    public void mouseDragged(int x, int y){
        Graphics l= getGraphics();
        l.setColor(Color.green);
        l.fillOval((x -50),(y - 50),10,10);
    }

    public static void main(String[] args){
        frm= new Means34();
        frm.setSize (300,300);
        frm.setVisible (True);
    }
}

1 个答案:

答案 0 :(得分:1)

它编译并运行正常,除了我必须更改行

frm.setVisible (True);  

frm.setVisible (true);