diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/CrashDialog.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/CrashDialog.java | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/CrashDialog.java b/src/main/java/cuchaz/enigma/gui/CrashDialog.java index c0c0869..3806f54 100644 --- a/src/main/java/cuchaz/enigma/gui/CrashDialog.java +++ b/src/main/java/cuchaz/enigma/gui/CrashDialog.java | |||
| @@ -13,8 +13,6 @@ package cuchaz.enigma.gui; | |||
| 13 | import java.awt.BorderLayout; | 13 | import java.awt.BorderLayout; |
| 14 | import java.awt.Container; | 14 | import java.awt.Container; |
| 15 | import java.awt.FlowLayout; | 15 | import java.awt.FlowLayout; |
| 16 | import java.awt.event.ActionEvent; | ||
| 17 | import java.awt.event.ActionListener; | ||
| 18 | import java.io.PrintWriter; | 16 | import java.io.PrintWriter; |
| 19 | import java.io.StringWriter; | 17 | import java.io.StringWriter; |
| 20 | 18 | ||
| @@ -31,11 +29,11 @@ public class CrashDialog { | |||
| 31 | 29 | ||
| 32 | private CrashDialog(JFrame parent) { | 30 | private CrashDialog(JFrame parent) { |
| 33 | // init frame | 31 | // init frame |
| 34 | m_frame = new JFrame(Constants.Name + " - Crash Report"); | 32 | m_frame = new JFrame(Constants.NAME + " - Crash Report"); |
| 35 | final Container pane = m_frame.getContentPane(); | 33 | final Container pane = m_frame.getContentPane(); |
| 36 | pane.setLayout(new BorderLayout()); | 34 | pane.setLayout(new BorderLayout()); |
| 37 | 35 | ||
| 38 | JLabel label = new JLabel(Constants.Name + " has crashed! =("); | 36 | JLabel label = new JLabel(Constants.NAME + " has crashed! =("); |
| 39 | label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); | 37 | label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
| 40 | pane.add(label, BorderLayout.NORTH); | 38 | pane.add(label, BorderLayout.NORTH); |
| 41 | 39 | ||
| @@ -51,21 +49,15 @@ public class CrashDialog { | |||
| 51 | buttonsPanel.setLayout(buttonsLayout); | 49 | buttonsPanel.setLayout(buttonsLayout); |
| 52 | buttonsPanel.add(GuiTricks.unboldLabel(new JLabel("If you choose exit, you will lose any unsaved work."))); | 50 | buttonsPanel.add(GuiTricks.unboldLabel(new JLabel("If you choose exit, you will lose any unsaved work."))); |
| 53 | JButton ignoreButton = new JButton("Ignore"); | 51 | JButton ignoreButton = new JButton("Ignore"); |
| 54 | ignoreButton.addActionListener(new ActionListener() { | 52 | ignoreButton.addActionListener(event -> { |
| 55 | @Override | 53 | // close (hide) the dialog |
| 56 | public void actionPerformed(ActionEvent event) { | 54 | m_frame.setVisible(false); |
| 57 | // close (hide) the dialog | ||
| 58 | m_frame.setVisible(false); | ||
| 59 | } | ||
| 60 | }); | 55 | }); |
| 61 | buttonsPanel.add(ignoreButton); | 56 | buttonsPanel.add(ignoreButton); |
| 62 | JButton exitButton = new JButton("Exit"); | 57 | JButton exitButton = new JButton("Exit"); |
| 63 | exitButton.addActionListener(new ActionListener() { | 58 | exitButton.addActionListener(event -> { |
| 64 | @Override | 59 | // exit enigma |
| 65 | public void actionPerformed(ActionEvent event) { | 60 | System.exit(1); |
| 66 | // exit enigma | ||
| 67 | System.exit(1); | ||
| 68 | } | ||
| 69 | }); | 61 | }); |
| 70 | buttonsPanel.add(exitButton); | 62 | buttonsPanel.add(exitButton); |
| 71 | pane.add(buttonsPanel, BorderLayout.SOUTH); | 63 | pane.add(buttonsPanel, BorderLayout.SOUTH); |