当前位置: 技术问答>java相关
我这个怎么不显示我想要的东西呀?
来源: 互联网 发布时间:2015-06-29
本文导语: import java.applet.Applet; import java.awt.*; public class SimplePaint{ public static void main(String agrs[]){ Frame f=new Frame(); Canvas can=new Canvas(); f.add(can); f.setSize(300,200); f.setVisible(true); } } class ccc extends Canvas{ public ...
import java.applet.Applet;
import java.awt.*;
public class SimplePaint{
public static void main(String agrs[]){
Frame f=new Frame();
Canvas can=new Canvas();
f.add(can);
f.setSize(300,200);
f.setVisible(true);
}
}
class ccc extends Canvas{
public void paint(Graphics g){
g.setColor(Color.black);
g.fillRect(0,0,300,300);
g.setColor(Color.white);
g.fillOval(30,30,50,50);
}
}
import java.awt.*;
public class SimplePaint{
public static void main(String agrs[]){
Frame f=new Frame();
Canvas can=new Canvas();
f.add(can);
f.setSize(300,200);
f.setVisible(true);
}
}
class ccc extends Canvas{
public void paint(Graphics g){
g.setColor(Color.black);
g.fillRect(0,0,300,300);
g.setColor(Color.white);
g.fillOval(30,30,50,50);
}
}
|
import java.applet.Applet;
import java.awt.*;
public class SimplePaint{
public static void main(String agrs[]){
Frame f=new Frame();
Canvas can=new Canvas(); //把你的继承了Canvas的类代替这里的Canvas!!!
f.add(can);
f.setSize(300,200);
f.setVisible(true);
}
}
class ccc extends Canvas{
public void paint(Graphics g){
g.setColor(Color.black);
g.fillRect(0,0,300,300);
g.setColor(Color.white);
g.fillOval(30,30,50,50);
}
}
也就是
public class SimplePaint{
public static void main(String agrs[]){
Frame f=new Frame();
ccc can=new ccc(); //把你的继承了Canvas的类代替这里的Canvas!!!
f.add(can);
f.setSize(300,200);
f.setVisible(true);
}
}
import java.awt.*;
public class SimplePaint{
public static void main(String agrs[]){
Frame f=new Frame();
Canvas can=new Canvas(); //把你的继承了Canvas的类代替这里的Canvas!!!
f.add(can);
f.setSize(300,200);
f.setVisible(true);
}
}
class ccc extends Canvas{
public void paint(Graphics g){
g.setColor(Color.black);
g.fillRect(0,0,300,300);
g.setColor(Color.white);
g.fillOval(30,30,50,50);
}
}
也就是
public class SimplePaint{
public static void main(String agrs[]){
Frame f=new Frame();
ccc can=new ccc(); //把你的继承了Canvas的类代替这里的Canvas!!!
f.add(can);
f.setSize(300,200);
f.setVisible(true);
}
}