2013-10-31 117 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);