[Java] 坦克大战3 →→→→→进入此内容的聊天室

来自 , 2020-08-12, 写在 Java, 查看 107 次.
URL http://www.code666.cn/view/3b712de4
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package tank;
  8.  
  9. import java.awt.Color;
  10. import java.awt.Graphics;
  11. import javax.swing.JFrame;
  12. import javax.swing.JPanel;
  13.  
  14.  class T extends JFrame {
  15.  
  16.     small mp = null;
  17. //    GuanQia gqmb  =null;
  18.     public static void main(String[] args) {
  19.         T t = new T();
  20.     }
  21.  
  22.     public T() {
  23.        mp = new small();
  24.  
  25.    //     gqmb = new GuanQia();
  26.        
  27.    //     this.add(gqmb);
  28.        this.add(mp);
  29.  
  30.         this.setSize(600,500);
  31.         this.setLocation(300, 280);
  32.         this.setDefaultCloseOperation(3);
  33.         this.setVisible(true);
  34.     }
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41. public class small extends JPanel {
  42.     public small(){
  43.        
  44.     }
  45.    
  46.      public void paint(Graphics g) {
  47.          super.paint(g);
  48.           g.fillRect(0, 0, 500, 400);
  49.          
  50.           this.drawTank(0, 0, g);
  51.      }
  52.      public void drawTank(int x, int y,Graphics g){
  53.          
  54.          g.setColor(Color.red);
  55.             g.fill3DRect(x, y, 5, 30, false);
  56.                 g.fill3DRect(x + 15, y, 5, 30, false);
  57.                 g.fill3DRect(x + 5, y + 5, 10, 20, false);
  58.                 g.fillOval(x + 5, y + 10, 10, 10);
  59.                 g.drawLine(x + 10, y + 15, x + 10, y - 5);
  60.      }
  61.      
  62. }
  63.  

回复 "坦克大战3"

这儿你可以回复上面这条便签

captcha