当前位置: 技术问答>java相关
我按照书上的代码输入程序,想画图,但怎么什么也画不出来?真急人,哪怕我现在能画一个点也好啊.
来源: 互联网 发布时间:2015-04-21
本文导语: 代码如下'我用的是JB5 import java.awt.*; import java.util.Random; public class GraphicsTest extends Frame{ public static void main(String args[]){ int width=300,height=200; int i,r,rx1,ry1,rx2,ry2; GraphicsTest test1= new GraphicsTest(); t...
代码如下'我用的是JB5
import java.awt.*;
import java.util.Random;
public class GraphicsTest extends Frame{
public static void main(String args[]){
int width=300,height=200;
int i,r,rx1,ry1,rx2,ry2;
GraphicsTest test1= new GraphicsTest();
test1.setSize(width,height);
test1.setVisible(true);
Graphics g=test1.getGraphics();
Random rand=new Random();
Color c[]={Color.black,Color.red,Color.green,Color.blue,Color.yellow};
String str[]={"hello","world","java","computer","how are you?"};
while (true) {
r=rand.nextInt(5);
for(i=0;i
import java.awt.*;
import java.util.Random;
public class GraphicsTest extends Frame{
public static void main(String args[]){
int width=300,height=200;
int i,r,rx1,ry1,rx2,ry2;
GraphicsTest test1= new GraphicsTest();
test1.setSize(width,height);
test1.setVisible(true);
Graphics g=test1.getGraphics();
Random rand=new Random();
Color c[]={Color.black,Color.red,Color.green,Color.blue,Color.yellow};
String str[]={"hello","world","java","computer","how are you?"};
while (true) {
r=rand.nextInt(5);
for(i=0;i