JPanel画的不显示


public class MyPanel extends JPanel {
    MyTank myTank = null;

    public MyPanel() {
        this.myTank = new MyTank(100,100);
    }

    @Override
    public void print(Graphics g) {
        super.print(g);
        drawTank(myTank.getX(),myTank.getY(),g,0,0);
    }
    /**
     *
     * @param x 坦克横坐标
     * @param y 坦克纵坐标
     * @param g 画笔
     * @param direction 坦克方向
     * @param type 坦克类型
     *
     *
     */
    public void drawTank(int x,int y,Graphics g,int direction,int type)
    {
        //根据敌我类型,设置不同颜色
        switch (type){
            case 0://我方坦克
                g.setColor(new Color(100,30,255));
                break;
            case 1://敌方坦克
                g.setColor(Color.yellow);
                break;
        }
        //根据方向来绘制坦克
        switch (direction){
            case 0:
                g.fill3DRect(x,y,10,60,false);
                break;
            default:
                System.out.println("方向异常");
        }
    }
}
public class TankGame extends JFrame{
    MyPanel myPanel = null;

    public TankGame() {
        this.myPanel = new MyPanel();
        this.myPanel.setBackground(new Color(210,105,30));
        this.getContentPane().add(myPanel);
        this.setVisible(true);
        this.setSize(1000,750);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        TankGame tankGame = new TankGame();
    }
}

画什么东西都不显示怎么办??,画直线、圆、正方形都不行

把第二段改成这样子:

public class TankGame extends JFrame{
    MyPanel myPanel = null;
 
   
 
    public static void main(String[] args) {
         public TankGame() {
        this.myPanel = new MyPanel();
        this.myPanel.setBackground(new Color(210,105,30));
        this.getContentPane().add(myPanel);
        this.setVisible(true);
        this.setSize(1000,750);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }
    }
}