⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamesettings.java

📁 一个java的免费游戏引擎,里面有文档,和例子
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

package com.golden.gamedev.funbox;

import com.golden.gamedev.engine.graphics.WindowExitListener;
import com.golden.gamedev.util.ImageUtil;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import javax.swing.*;

public abstract class GameSettings extends JDialog
    implements ActionListener, Runnable
{

    protected JCheckBox fullscreen;
    protected JCheckBox bufferstrategy;
    protected JCheckBox sound;
    protected JButton btnOK;
    protected JButton btnCancel;
    protected URL splashImage;

    public GameSettings(URL url)
    {
        super((Frame)null, "Settings", true);
        setResizable(false);
        addWindowListener(WindowExitListener.getInstance());
        setDefaultCloseOperation(2);
        splashImage = url;
        JPanel jpanel = initGUI();
        setContentPane(jpanel);
        pack();
        setLocationRelativeTo(null);
        setVisible(true);
    }

    public GameSettings()
    {
        this(((URL) (null)));
    }

    public GameSettings(boolean flag, boolean flag1)
    {
        initGUI();
        fullscreen.setSelected(flag);
        bufferstrategy.setSelected(flag1);
        dispose();
        start();
    }

    public GameSettings(boolean flag)
    {
        this(flag, true);
    }

    protected JPanel initGUI()
    {
        JPanel jpanel;
        (jpanel = new JPanel()).setLayout(new BorderLayout());
        JLabel jlabel = null;
        if(splashImage != null)
            try
            {
                jlabel = new JLabel(new ImageIcon(ImageUtil.getImage(splashImage)));
            }
            catch(Exception _ex)
            {
                jlabel = null;
            }
        JPanel jpanel1 = initSettings();
        JPanel jpanel2;
        (jpanel2 = new JPanel()).setLayout(new FlowLayout(2));
        jpanel2.setBorder(BorderFactory.createEmptyBorder(0, 0, 3, 0));
        btnOK = new JButton("OK");
        btnOK.addActionListener(this);
        getRootPane().setDefaultButton(btnOK);
        btnCancel = new JButton("Cancel");
        btnCancel.addActionListener(this);
        jpanel2.add(btnOK);
        jpanel2.add(btnCancel);
        if(jlabel != null)
            jpanel.add(jlabel, "North");
        if(jpanel1 != null)
            jpanel.add(jpanel1, "Center");
        jpanel.add(jpanel2, "South");
        return jpanel;
    }

    protected JPanel initSettings()
    {
        JPanel jpanel;
        (jpanel = new JPanel()).setLayout(new GridLayout(0, 2));
        javax.swing.border.Border border = BorderFactory.createEmptyBorder(6, 4, 3, 4);
        jpanel.setBorder(BorderFactory.createCompoundBorder(border, BorderFactory.createTitledBorder("Game Settings")));
        GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        isFullScreenSupported();
        boolean flag;
        flag;
        break MISSING_BLOCK_LABEL_63;
        printStackTrace();
        flag = false;
        fullscreen = new JCheckBox("Fullscreen", flag);
        fullscreen.setEnabled(flag);
        fullscreen.setToolTipText(flag ? "fullscreen/windowed mode" : "fullscreen mode not supported");
        bufferstrategy = new JCheckBox("Bufferstrategy", true);
        bufferstrategy.setToolTipText("turn this off if the game experiencing graphics problem");
        sound = new JCheckBox("Sound", true);
        sound.setToolTipText("turn on/off sound and music");
        jpanel.add(fullscreen);
        jpanel.add(bufferstrategy);
        jpanel.add(sound);
        return jpanel;
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        if(actionevent.getSource() == btnOK)
        {
            dispose();
            (new Thread(this)).start();
            return;
        }
        if(actionevent.getSource() == btnCancel)
            System.exit(0);
    }

    public void run()
    {
        start();
    }

    public abstract void start();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -