初学者请教:我编译的applet运行时出现下列情况,是哪里出了问题?--------------------Configuration: <Default>--------------------
Note: D:\test1\mycanvas.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.Process completed.
Note: D:\test1\mycanvas.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.Process completed.
import java.awt.*;class NewCanvas extends Canvas{
private int shape;
public void paint(Graphics g)
{
if (shape==1)
g.fillOval(50,10,60,60);
else
g.fillRect(50,10,60,60);
}
public void setShape(int s)
{
shape=s;
repaint();
}
}
public class mycanvas1 extends Applet{
private Panel p;
private NewCanvas c;
private Button b1,b2;
public void init()
{
p=new Panel();
c=new NewCanvas();
c.resize(185,125);
b1=new Button("Square");
b2=new Button("Circle");
p.setLayout(new BorderLayout());
p.add("North",b1);
p.add("South",b2);
setLayout(new BorderLayout());
add("West",p);
add("East",c);
}
public boolean action(Event e,Object o)
{
if(e.target==b1){
c.setShape(1);
c.setBackground(Color.blue);}
else {
c.setShape(2);
c.setBackground(Color.red);}
return true;
}
}
你看这个程序哪里存在bug?
就是编译成功拉,但是那些提示是警告不是错误所以可以运行,但是这也是说程序存在逻辑错误
没别的意思。上面的什么逻辑错误纯属胡说~