全屏无效

时间:2016-08-16 12:13:24

标签: java jframe render fullscreen

屏幕闪烁黑色,然后单独打开JFrame。

public Game() {
    myDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    JFrame frame = new JFrame();
    // frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    frame.setVisible(true);
    frame.add(this);

    myDevice.setFullScreenWindow(frame);
    try {
    } finally {
        myDevice.setFullScreenWindow(null);
    }

    time = 0;
    level = new LevelOne(this);
    this.requestFocus();
    try {
        bgImg = ImageIO.read(new File("Space.png"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    if (this.getBufferStrategy() == null)
        this.createBufferStrategy(2);
    bs = this.getBufferStrategy();
    timer.schedule(new TimerTask() {

        public void run() {
        calc();
        MobMover.calc();
        render();
        time++;
        }

    }, 0L, 40L);
}

我没有看到问题......:'(

0 个答案:

没有答案