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

📄 errornotificationdialog.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.BaseGraphics;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
import javax.swing.*;

public class ErrorNotificationDialog extends JDialog
    implements Runnable, ActionListener, WindowListener
{

    protected Throwable error;
    protected BaseGraphics bsGraphics;
    protected String title;
    protected String emailAddress;
    protected JTextArea textArea;
    static Class a;

    public ErrorNotificationDialog(Throwable throwable, BaseGraphics basegraphics, String s, String s1)
    {
        super((Frame)null, "Game Exception");
        throwable.printStackTrace();
        error = throwable;
        bsGraphics = basegraphics;
        title = s;
        emailAddress = s1;
        addWindowListener(this);
        if(basegraphics instanceof Applet)
        {
            Thread thread;
            (thread = new Thread(this)).setDaemon(true);
            thread.start();
            return;
        } else
        {
            initGUI();
            return;
        }
    }

    public void run()
    {
        try
        {
            Thread.sleep(1500L);
        }
        catch(InterruptedException _ex) { }
        initGUI();
    }

    protected void printStackTrace()
    {
        o(textArea, "Game Exception on " + title);
        String s = "------------------";
        for(int i = 0; i < title.length(); i++)
            s = s + "-";

        o(textArea, s);
        StringWriter stringwriter = new StringWriter();
        PrintWriter printwriter = new PrintWriter(stringwriter);
        error.printStackTrace(printwriter);
        o(textArea, stringwriter.toString());
        try
        {
            o(textArea, "Game Environment");
            o(textArea, "----------------");
            SimpleDateFormat simpledateformat = new SimpleDateFormat("EEE, dd MMM yyyy 'at' HH:mm");
            p(textArea, "Date/Time         : ", simpledateformat.format(Calendar.getInstance(TimeZone.getTimeZone("GMT+7")).getTime()));
            p(textArea, "Java Version      : ", q(new String[] {
                "java.vm.version", "java.vendor"
            }));
            p(textArea, "GTGE Version      : ", "0.2.3");
            p(textArea, "Environment       : ", bsGraphics.getGraphicsDescription());
            p(textArea, "Operating System  : ", q(new String[] {
                "os.name", "os.version", "sun.os.patch.level"
            }));
            p(textArea, "User Name         : ", q(new String[] {
                "user.name"
            }));
            p(textArea, "Working Directory : ", q(new String[] {
                "user.dir"
            }));
            return;
        }
        catch(Throwable throwable)
        {
            o(textArea, throwable.toString());
        }
    }

    protected void initGUI()
    {
        try
        {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch(Throwable _ex) { }
        Color color = new Color(236, 233, 216);
        textArea = new JTextArea();
        textArea.setEditable(false);
        textArea.setFont(new Font("Monospaced", 0, 11));
        textArea.setBackground(color);
        printStackTrace();
        JPanel jpanel;
        (jpanel = new JPanel()).setBackground(color);
        jpanel.setLayout(new BorderLayout());
        jpanel.setBorder(BorderFactory.createEmptyBorder(10, 7, 10, 7));
        JPanel jpanel1;
        (jpanel1 = new JPanel()).setLayout(new BoxLayout(jpanel1, 0));
        jpanel1.setBackground(color);
        jpanel1.setBorder(BorderFactory.createEmptyBorder(0, 2, 10, 0));
        JPanel jpanel2;
        (jpanel2 = new JPanel()).setLayout(new BoxLayout(jpanel2, 1));
        jpanel2.setBackground(color);
        Font font = new Font("SansSerif", 0, 12);
        JLabel jlabel;
        (jlabel = new JLabel("An unrecoverable error occured in the game.")).setFont(font);
        JLabel jlabel1;
        (jlabel1 = new JLabel("Please mail below exception to:")).setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
        jlabel1.setFont(font);
        JLabel jlabel2 = new JLabel(emailAddress);
        if(emailAddress == null || emailAddress.length() == 0)
            jlabel2.setText("the game author");
        jlabel2.setFont(font.deriveFont(1));
        jpanel2.add(jlabel);
        jpanel2.add(jlabel1);
        jpanel2.add(jlabel2);
        JPanel jpanel3;
        (jpanel3 = new JPanel()).setLayout(new FlowLayout(2));
        jpanel3.setBackground(color);
        JPanel jpanel4;
        (jpanel4 = new JPanel()).setLayout(new GridLayout(0, 1, 0, 9));
        jpanel4.setOpaque(false);
        Color color1 = new Color(252, 249, 232);
        Font font1 = new Font("Dialog", 0, 11);
        ImageIcon aimageicon[];
        (aimageicon = new ImageIcon[2])[0] = new ImageIcon((a != null ? a : (a = a("com.golden.gamedev.funbox.ErrorNotificationDialog"))).getResource("Icon1.png"));
        JButton jbutton;
        (jbutton = new JButton("copy to clipboard", aimageicon[0])).setBackground(color1);
        jbutton.setBorderPainted(false);
        jbutton.setFocusPainted(false);
        jbutton.setIconTextGap(9);
        jbutton.setVerticalTextPosition(1);
        jbutton.setHorizontalAlignment(2);
        jbutton.setFont(font1);
        jbutton.addActionListener(this);
        jbutton.setPreferredSize(new Dimension(120, 22));
        jbutton.setMargin(new Insets(0, 0, 0, 0));
        aimageicon[1] = new ImageIcon((a != null ? a : (a = a("com.golden.gamedev.funbox.ErrorNotificationDialog"))).getResource("Icon2.png"));
        JButton jbutton1;
        (jbutton1 = new JButton("close application", aimageicon[1])).setBackground(color1);
        jbutton1.setBorderPainted(false);
        jbutton1.setFocusPainted(false);
        jbutton1.setIconTextGap(9);
        jbutton1.setVerticalTextPosition(1);
        jbutton1.setHorizontalAlignment(2);
        jbutton1.setFont(font1);
        jbutton1.addActionListener(this);
        jbutton1.setPreferredSize(new Dimension(120, 22));
        jbutton1.setMargin(new Insets(0, 0, 0, 0));
        jpanel4.add(jbutton);
        jpanel4.add(jbutton1);
        jpanel3.add(jpanel4);
        jpanel1.add(jpanel2);
        jpanel1.add(jpanel3);
        JScrollPane jscrollpane;
        (jscrollpane = new JScrollPane(textArea)).setBackground(color);
        jscrollpane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(0), BorderFactory.createEmptyBorder(3, 4, 3, 4)));
        jpanel.add(jpanel1, "North");
        jpanel.add(jscrollpane, "Center");
        setContentPane(jpanel);
        pack();
        setSize(475, 400);
        setLocationRelativeTo(null);
        try
        {
            Toolkit.getDefaultToolkit().beep();
        }
        catch(Throwable _ex) { }
        setResizable(false);
        setVisible(true);
        getRootPane().setDefaultButton(jbutton1);
        jbutton1.requestFocus();
        do
        {
            do
            {
                do
                    try
                    {
                        Thread.sleep(500L);
                    }
                    catch(InterruptedException _ex) { }
                while(isFocused());
                try
                {
                    Thread.sleep(5000L);
                }
                catch(InterruptedException _ex) { }
            } while(isFocused());
            textArea.selectAll();
            textArea.copy();
            closeDialog();
        } while(true);
        printStackTrace();
        closeDialog();
        return;
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        textArea.selectAll();
        textArea.copy();
        if(actionevent.getActionCommand().equals("close application"))
            closeDialog();
    }

    public void closeDialog()
    {
        try
        {
            if(!(bsGraphics instanceof Applet))
                System.exit(0);
        }
        catch(Throwable _ex) { }
        dispose();
    }

    public void windowClosing(WindowEvent windowevent)
    {
        closeDialog();
    }

    public void windowOpened(WindowEvent windowevent)
    {
    }

    public void windowClosed(WindowEvent windowevent)
    {
    }

    public void windowIconified(WindowEvent windowevent)
    {
    }

    public void windowDeiconified(WindowEvent windowevent)
    {
    }

    public void windowActivated(WindowEvent windowevent)
    {
    }

    public void windowDeactivated(WindowEvent windowevent)
    {
    }

    private void o(JTextArea jtextarea, String s)
    {
        jtextarea.append(s + "\n");
    }

    private void p(JTextArea jtextarea, String s, String s1)
    {
        jtextarea.append(s);
        jtextarea.append(s1 + "\n");
    }

    private String q(String as[])
    {
        Throwable throwable;
        StringBuffer stringbuffer = new StringBuffer();
        for(int i = 0; i < as.length; i++)
        {
            String s;
            try
            {
                if((s = System.getProperty(as[i])) != null)
                    stringbuffer.append(s).append(" ");
            }
            // Misplaced declaration of an exception variable
            catch(Throwable throwable)
            {
                return throwable.toString();
            }
        }

        if(stringbuffer.length() > 0)
            stringbuffer.deleteCharAt(stringbuffer.length() - 1);
        return stringbuffer.toString();
    }

    static Class a(String s)
    {
        return Class.forName(s);
        ClassNotFoundException classnotfoundexception;
        classnotfoundexception;
        throw new NoClassDefFoundError(classnotfoundexception.getMessage());
    }
}

⌨️ 快捷键说明

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