吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1346|回复: 3
收起左侧

[已解决] Java关于飞机大战项目的一个基础问题

[复制链接]
会断 发表于 2021-5-19 21:01
本帖最后由 会断 于 2021-5-25 08:26 编辑

QQ截图20210519204640.png

pause输出为4是什么原因?gif的输出为2是因为代码不对吗,我可能还没学到
[Java] 纯文本查看 复制代码
package cn.tedu;

import javax.swing.ImageIcon;

public class Images {
        public static final ImageIcon[] airplane;
        public static final ImageIcon[] bigairplane;
        public static final ImageIcon bee;
        public static final ImageIcon bullet;
        public static final ImageIcon[] hero;
        public static final ImageIcon bom;
        public static final ImageIcon sky;
        public static final ImageIcon start;
        public static final ImageIcon pause;
        public static final ImageIcon gameover;
        static {
                airplane = new ImageIcon[2];
                airplane[0] = new ImageIcon("images/airplane0.png");
                airplane[1] = new ImageIcon("images/airplane1.png");
                bigairplane = new ImageIcon[2];
                bigairplane[0] = new ImageIcon("images/bigairplane0.png");
                bigairplane[1] = new ImageIcon("images/bigairplane1.png");
                bee = new ImageIcon("images/bee0.gif");
                bullet = new ImageIcon("images/bullet.png");
                hero = new ImageIcon[2];
                hero[0] = new ImageIcon("images/hero0.png");
                hero[1] = new ImageIcon("images/hero1.png");
                bom = new ImageIcon("images/bom.gif");
                sky = new ImageIcon("images/background.png");
                start = new ImageIcon("images/start.png");
                pause = new ImageIcon("iamges/pause.png");
                gameover = new ImageIcon("images/gameover.png");
        }
        public static void main(String[] args) {
                System.out.println(airplane[0].getImageLoadStatus());
                System.out.println(airplane[1].getImageLoadStatus());
                System.out.println(bigairplane[0].getImageLoadStatus());
                System.out.println(bigairplane[1].getImageLoadStatus());
                System.out.println(bee.getImageLoadStatus());
                System.out.println(bullet.getImageLoadStatus());
                System.out.println(hero[0].getImageLoadStatus());
                System.out.println(hero[1].getImageLoadStatus());
                System.out.println(bom.getImageLoadStatus());
                System.out.println(sky.getImageLoadStatus());
                System.out.println(start.getImageLoadStatus());
                System.out.println(pause.getImageLoadStatus());
                System.out.println(gameover.getImageLoadStatus());
                
        }
}


发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

夜曲 发表于 2021-5-23 22:36
按住CTRL点一下那个方法,看看源码就知道了啊
VioletKiss 发表于 2021-5-24 09:47
你说的是这个吗?  详见JDK源码:java.awt.Mediatracker.java

/**
     * Flag indicating that media is currently being loaded.
     * @see         java.awt.MediaTracker#statusAll
     * @see         java.awt.MediaTracker#statusID
     */
    public static final int LOADING = 1;

    /**
     * Flag indicating that the downloading of media was aborted.
     * @see         java.awt.MediaTracker#statusAll
     * @see         java.awt.MediaTracker#statusID
     */
    public static final int ABORTED = 2;

    /**
     * Flag indicating that the downloading of media encountered
     * an error.
     * @see         java.awt.MediaTracker#statusAll
     * @see         java.awt.MediaTracker#statusID
     */
    public static final int ERRORED = 4;

    /**
     * Flag indicating that the downloading of media was completed
     * successfully.
     * @see         java.awt.MediaTracker#statusAll
     * @see         java.awt.MediaTracker#statusID
     */
    public static final int COMPLETE = 8;
 楼主| 会断 发表于 2021-5-25 08:26
VioletKiss 发表于 2021-5-24 09:47
你说的是这个吗?  详见JDK源码:java.awt.Mediatracker.java

/**

不是..不过以解决了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-17 03:27

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表