2013-10-31 114 views
-2

确定这样的IM不知道为什么这个程序不能正常工作,我在做这个项目在学校和其未完成的,但现在每当我试图运行它,我得到错误信息的错误,我无法弄清楚

Exception in thread "main" java.lang.Error: Unresolved compilation problem: at 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); 
    } 
} 
+0

哪条线是线96? –

+0

删除行不会改变任何东西,除非您重新编译它。重新编译你的代码并告诉我们哪一行(在你的代码中标记)是否给出了这个问题。同时注意编辑信息,因为它们会更好地告诉你真正的问题。 – SJuan76

+0

哪一行是96?这是一个'frm.setVisible(false);'?由于GBFrame扩展了Frame,因此该行没有错误。 – vikingsteve

回答

1

它编译和我运行良好,但我不得不行

frm.setVisible (True); 

改变

frm.setVisible (true);