找回密码
 立即注册
搜索
查看: 1736|回复: 2

[软件] s1万能系列。。。。JAVA GUI设计。。。

[复制链接]
     
发表于 2011-10-15 15:49 | 显示全部楼层 |阅读模式
jComboBox1.setModel(new DefaultComboBoxModel(player.getBackPack().toArray()));

player class:

    public Player(Position position, String name, double maxStamina,
                  double maxBackpackWeight, double maxBackpackSize)
    {
       this.position          = position;
       this.name              = name;
       this.maxStamina        = maxStamina;
       this.stamina = maxStamina;
       this.maxBackpackWeight = maxBackpackWeight;
       this.maxBackpackSize = maxBackpackSize;
       this.alive = true;
       this.backpack = new HashSet<Item>();
    }

    public Set<Item> getBackPack()
    {
        return this.backpack;
    }

Exception in thread "main" java.lang.NullPointerException
        at nz.ac.aut.prog2.ass3.gui.LemurIslandUI.initComponents(LemurIslandUI.java:249)
        at nz.ac.aut.prog2.ass3.gui.LemurIslandUI.<init>(LemurIslandUI.java:33)
        at nz.ac.aut.prog2.ass3.Main.main(Main.java:24)
求解。。。。。现在错误就指着jComboBox1.setModel这里。。。。完全没有头绪啊
回复

使用道具 举报

发表于 2011-10-15 16:24 | 显示全部楼层
NullPointerException
空指针你妹啊.....
检查下player以及player.getBackPack()是否为NULL
回复

使用道具 举报

     
 楼主| 发表于 2011-10-15 16:36 | 显示全部楼层
恩。。。指定了GAME内的PLAYER后通过。。。。继续写下去。。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|上海互联网违法和不良信息举报中心|网上有害信息举报专区|962110 反电信诈骗|举报电话 021-62035905|Stage1st ( 沪ICP备13020230号-1|沪公网安备 31010702007642号 )

GMT+8, 2025-9-15 20:00 , Processed in 0.052516 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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