当前位置: 技术问答>java相关
新手求教。万分急:(
来源: 互联网 发布时间:2015-06-21
本文导语: 请问下面的代码为什么不能new Ball()? import java.awt.*; import java.util.*; public class Ball extends Frame { public Ball(Canvas c) { box=c; } public void draw() { Graphics g=box.getGraphics(); g.fillOval(x,y,XS...
请问下面的代码为什么不能new Ball()?
import java.awt.*;
import java.util.*;
public class Ball extends Frame
{
public Ball(Canvas c)
{
box=c;
}
public void draw()
{
Graphics g=box.getGraphics();
g.fillOval(x,y,XSIZE,YSIZE);
g.dispose();
}
public void move()
{
Graphics g=box.getGraphics();
g.fillOval(x,y,XSIZE,YSIZE);
Dimension d=box.size();
//起始点x,y
//终点x1,y1
if((x1>x)&&(x1>0)&&(y1>0)&&(x10)&&(x1
import java.awt.*;
import java.util.*;
public class Ball extends Frame
{
public Ball(Canvas c)
{
box=c;
}
public void draw()
{
Graphics g=box.getGraphics();
g.fillOval(x,y,XSIZE,YSIZE);
g.dispose();
}
public void move()
{
Graphics g=box.getGraphics();
g.fillOval(x,y,XSIZE,YSIZE);
Dimension d=box.size();
//起始点x,y
//终点x1,y1
if((x1>x)&&(x1>0)&&(y1>0)&&(x10)&&(x1