我的应用程序在日食中工作正常,而不是在jar中

时间:2013-11-27 08:53:52

标签: java eclipse jframe executable-jar

我有一个用Eclipse开发的游戏,当我从那里运行时,它运行得很好。它为您提供了一个JFrame框架,您可以在其中选择难度,如果您这样做,您可以在新框架中玩游戏。它工作得很好,直到我创建了设置框架。

所以在Eclipse中,我运行应用程序,设置设置,单击按钮,第一帧不可见,这将打开下一帧。执行导出的runnable jar时,它不会停止,但第二帧(游戏帧)是不可见的。

这是主要的。

public static void main(String[] args) {
    int ammuData = 0;
    int enemyData = 0;
    Config config = new Config();

    while (config.frame.isVisible()) {
        ammuData = config.getAmmu();
        enemyData = config.getEnemies();
    }

    Game game = new Game(ammuData, enemyData);
    game.frame.setResizable(false);
    game.frame.setTitle(Game.title);
    game.frame.add(game);
    game.frame.pack();
    game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    game.frame.setLocationRelativeTo(null);
    game.frame.setVisible(true);
    game.start();
}

0 个答案:

没有答案