会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132657个问题
WEB前端全系列/第二十阶段:Vue2企业级项目(旧)/疫情动态实时播报 2312楼

package com.bjsxt;

import java.awt.*;
import javax.swing.*;

public class ballGame extends JFrame {
    Image ball=Toolkit.getDefaultToolkit().createImage("images/ball.png");
    Image desk=Toolkit.getDefaultToolkit().createImage("images/desk.png");

    double x=200;
    double y=200;
    double degree=3.14/3;

    public void paint(Graphics graphics){
        System.out.println("窗口被画了一次");
        graphics.drawImage(desk,0,0,null);
        graphics.drawImage(ball,(int)x,(int)y,null);

        x=x+10*Math.cos(degree);
        y=y*10*Math.sin(degree);

        if(y>501-40-30||y<40+40){
            degree=-degree;

        }

        if(x>856-40-30||x<40){
            degree=3.14-degree;
        }



    }

    void launchFrame(){
        setSize(856,501);
        setLocation(100,100);
        setVisible(true);

        while(true){
            repaint();

            try {
                Thread.sleep(40);
            }catch(InterruptedException e){
                e.printStackTrace();
            }

        }


    }


    public static void main(String[] args){
        System.out.println("我的小游戏开始了!");

        ballGame game=new ballGame();
        game.launchFrame();






    }
}

GIF.gif

为什么没有球啊

JAVA 全系列/第一阶段:JAVA 快速入门/IDEA的使用和第一个java项目 2314楼
Python 全系列/第七阶段:网页编程基础/html5 2318楼
JAVA 全系列/第五阶段:JavaWeb开发/Servlet技术详解 2320楼
JAVA 全系列/第十一阶段:消息中间件与高并发处理/RocketMQ(旧) 2321楼
Python 全系列/第一阶段:Python入门/编程基本概念 2322楼

<s> [webpack.Progress] 92% chunk asset optimization

<s> [webpack.Progress] 93% after chunk asset optimization

<s> [webpack.Progress] 93% asset optimization

<s> [webpack.Progress] 94% after asset optimization

<s> [webpack.Progress] 94% after seal

<s> [webpack.Progress] 95% emitting

<s> [webpack.Progress] 95% emitting HtmlWebpackPlugin

<s> [webpack.Progress] 95% emitting CopyPlugin

<s> [webpack.Progress] 98% after emitting

<s> [webpack.Progress] 98% after emitting CopyPlugin


 ERROR  Failed to compile with 1 error18:57:25



 error  in ./src/components/Login.vue?vue&type=style&index=0&lang=less&scope=true&


Syntax Error: TypeError: this.getOptions is not a function



 @ ./node_modules/vue-style-loader??ref--10-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/

stylePostLoader.js!./node_modules/postcss-loader/src??ref--10-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref--10-oneOf-1-3!./node_modules/cach

e-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Login.vue?vue&type=style&index=0&lang=less&scope=tr

ue& 4:14-450 14:3-18:5 15:22-458

 @ ./src/components/Login.vue?vue&type=style&index=0&lang=less&scope=true&

 @ ./src/components/Login.vue

 @ ./src/router/index.js

 @ ./src/main.js

 @ multi (webpack)-dev-server/client?http://192.168.1.3:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js



<s> [webpack.Progress] 98% after emitting vue-cli-dashboard-plugin

<s> [webpack.Progress] 100% 


 WARN  

Couldn't parse bundle asset "H:\vue\vue_shop\dist\js\chunk-vendors.js".

Analyzer will use module sizes from stats file.


Python 全系列/第九阶段:Flask百战电商后台系统/Flask百战电商后台项目 2323楼
JAVA 全系列/(隐藏)第三十阶段:设计模式/框架源码分析(拓展)/GOF23 设计模式 2325楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637