该楼层疑似违规已被系统折叠隐藏此楼查看此楼
www.qht02.com.cn全球最大搜索
packagecom.qhit;
importjava.awt.Graphics;
importjava.awt.event.KeyListener;
importjavax.swing.JFrame;
importjavax.swing.JPanel;
publicclassGoodextendsJFrame{//窗口设计
Good(){
JPaneljp=newJPanel();//实现窗口
this.add(jp);
Mianm=newMian();//调用画法
this.add(m);
//this.addKeyListener(m);
this.setSize(600,480);
this.setDefaultCloseOperation(3);
this.setVisible(true);
}
}
刘佳敏14:31:07
packagecom.qhit;
importjava.awt.event.KeyListener;
importjavax.swing.JFrame;
importjavax.swing.JPanel;
publicclassText{
publicstaticvoidmain(String[]args){
Mianm=newMian();
JFramejf=newJFrame();
jf.add(m);实现画法
newGood();//实现窗口
}
}
刘佳敏14:31:16
packagecom.qhit;
importjava.awt.Color;
importjava.awt.Graphics;
importjavax.swing.JPanel;
publicclassMianextendsJPanel{//具体实现画法
intx=200;
inty=150;
intzx=250;
intzy=100;
intzx1=250;
intzy1=100;
intzx2=265;
intzy2=100;
intzx4=255;
intzy4=100;
intzx3=240;
intzy3=100;
intzx5=240;
intzy5=200;
publicvoidpaint(Graphicsg){
super.paint(g);
g.fillRect(x,y,100,10);
g.fillRect(zx,zy,10,100);
g.fillRect(zx1,zy1,5,5);
g.fillRect(zx2,zy2,5,20);
g.fillRect(zx3,zy3,5,20);
g.fillRect(zx4,zy4,5,5);
g.fillRect(zx5,zy5,5,50);//敌机
g.setColor(Color.red);
}
}