当前位置: 代码迷 >> Java相关 >> [求助]版主大虾们一定要帮我!!!
  详细解决方案

[求助]版主大虾们一定要帮我!!!

热度:160   发布时间:2005-10-12 15:27:00.0
[求助]版主大虾们一定要帮我!!!

执行程序,发现以下错误请版主大虾明示!!! import java.awt.*; public class Plot extends java.applet.Applet{ Label statLabel = new Label("Current Statistics:"); Graph stats = new Graph();

public void init(){ BorderLayout border = new BorderLayout(); setLayout(border); add("North",statLabel); add("Center",stats); } } class Graph extends java.awt.Canvas{ int[] point = {1,10,3,5,8,7,2,2,5,9,};

public void paint (Graphics screen){ for(int i=0;i<10;i++){ Color blueHue = new Color (0,0,255-(i*20)); screen.SetColor(blueHue); screen.fillRect(0,i*20,point[i]*20,17); } } } Plot.java:19:can not symbol symbol:methhod setColor(java.awt.Color) location:class java.awt.Graphics screen.setColor(blueHue);

搜索更多相关的解决方案: 版主  

----------------解决方案--------------------------------------------------------

import java.awt.*; public class Plot extends java.applet.Applet{ Label statLabel = new Label("Current Statistics:"); Graph stats = new Graph();

public void init(){ BorderLayout border = new BorderLayout(); setLayout(border); add(statLabel,"North"); //add里面先加的是组件,然后才是方向,下面一样 add(stats,"Center"); } } class Graph extends java.awt.Canvas{ int[] point = {1,10,3,5,8,7,2,2,5,9,};

public void paint (Graphics screen){ for(int i=0;i<10;i++){ Color blueHue = new Color (0,0,255-(i*20)); screen.setColor(blueHue); //是setColor不是SetColor,JAVA对大小写太敏感了…… screen.fillRect(0,i*20,point[i]*20,17); } } }


----------------解决方案--------------------------------------------------------
谢谢楼上的
----------------解决方案--------------------------------------------------------
screen.setColor(blueHue);
大小写错了
----------------解决方案--------------------------------------------------------
  相关解决方案