|
12 | 12 | * Created by Nate on 1/12/2015. |
13 | 13 | */ |
14 | 14 | public class AboutDialog { |
15 | | - private JDialog mDialog; |
| 15 | +private JDialog mDialog; |
16 | 16 |
|
17 | | - public AboutDialog(Frame parent) { |
18 | | - Locale locale = new Locale("en", "US"); |
19 | | - ResourceBundle resources = ResourceBundle.getBundle("build", locale); |
| 17 | +public AboutDialog(Frame parent) { |
| 18 | + Locale locale = new Locale("en", "US"); |
| 19 | + ResourceBundle resources = ResourceBundle.getBundle("build", locale); |
20 | 20 |
|
21 | | - mDialog = new JDialog(parent); |
| 21 | + mDialog = new JDialog(parent); |
22 | 22 |
|
23 | | - mDialog.setTitle("About"); |
| 23 | + mDialog.setTitle("About"); |
24 | 24 |
|
25 | | - mDialog.setResizable(false); |
26 | | - mDialog.setModal(true); |
| 25 | + mDialog.setResizable(false); |
| 26 | + mDialog.setModal(true); |
27 | 27 |
|
28 | | - JPanel mainPanel = new JPanel(); |
29 | | - mDialog.add(mainPanel); |
30 | | - GridLayout mainLayout = new GridLayout(2, 1); |
31 | | - mainPanel.setLayout(mainLayout); |
| 28 | + JPanel mainPanel = new JPanel(); |
| 29 | + mDialog.add(mainPanel); |
| 30 | + GridLayout mainLayout = new GridLayout(2, 1); |
| 31 | + mainPanel.setLayout(mainLayout); |
32 | 32 |
|
33 | | - JPanel infoPanel = new JPanel(); |
34 | | - mainPanel.add(infoPanel); |
35 | | - GridLayout infoLayout1 = new GridLayout(1, 2); |
36 | | - infoPanel.setLayout(infoLayout1); |
37 | | - JLabel labelLogo = new JLabel(SwingIconUtil.createImageIcon(BuildInfo.ICON_LOGO_LARGE)); |
38 | | - infoPanel.add(labelLogo); |
| 33 | + JPanel infoPanel = new JPanel(); |
| 34 | + mainPanel.add(infoPanel); |
| 35 | + GridLayout infoLayout1 = new GridLayout(1, 2); |
| 36 | + infoPanel.setLayout(infoLayout1); |
| 37 | + JLabel labelLogo = new JLabel(SwingIconUtil.createImageIcon(BuildInfo.ICON_LOGO_LARGE)); |
| 38 | + infoPanel.add(labelLogo); |
39 | 39 |
|
40 | | - JPanel descriptionPanel = new JPanel(); |
41 | | - infoPanel.add(descriptionPanel); |
42 | | - BoxLayout descriptionLayout = new BoxLayout(descriptionPanel, BoxLayout.Y_AXIS); |
| 40 | + JPanel descriptionPanel = new JPanel(); |
| 41 | + infoPanel.add(descriptionPanel); |
| 42 | + BoxLayout descriptionLayout = new BoxLayout(descriptionPanel, BoxLayout.Y_AXIS); |
43 | 43 |
|
44 | | - descriptionPanel.setLayout(descriptionLayout); |
45 | | - descriptionPanel.setBorder(new EmptyBorder(10, 5, 10, 5)); |
46 | | - descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_NAME)); |
47 | | - JLabel labelDescription = new JLabel(BuildInfo.APPLICATION_DESCRIPTION); |
48 | | - labelDescription.setFont(new Font(Font.MONOSPACED, Font.ITALIC, 12)); |
49 | | - labelDescription.setBorder(new EmptyBorder(5, 5, 5, 5)); |
50 | | - descriptionPanel.add(labelDescription); |
51 | | - descriptionPanel.add( |
52 | | - new JLabel("Version: " + resources.getString(BuildInfo.APPLICATION_VERSION_RESOURCE))); |
53 | | - descriptionPanel.add( |
54 | | - new JLabel( |
55 | | - "Build Date: " + resources.getString(BuildInfo.APPLICATION_BUILD_DATE_RESOURCE))); |
56 | | - descriptionPanel.add(Box.createVerticalGlue()); |
57 | | - descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_COPYRIGHT)); |
58 | | - descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_WEBSITE)); |
| 44 | + descriptionPanel.setLayout(descriptionLayout); |
| 45 | + descriptionPanel.setBorder(new EmptyBorder(10, 5, 10, 5)); |
| 46 | + descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_NAME)); |
| 47 | + JLabel labelDescription = new JLabel(BuildInfo.APPLICATION_DESCRIPTION); |
| 48 | + labelDescription.setFont(new Font(Font.MONOSPACED, Font.ITALIC, 12)); |
| 49 | + labelDescription.setBorder(new EmptyBorder(5, 5, 5, 5)); |
| 50 | + descriptionPanel.add(labelDescription); |
| 51 | + descriptionPanel.add( |
| 52 | + new JLabel("Version: " + resources.getString(BuildInfo.APPLICATION_VERSION_RESOURCE))); |
| 53 | + descriptionPanel.add( |
| 54 | + new JLabel( |
| 55 | + "Build Date: " + resources.getString(BuildInfo.APPLICATION_BUILD_DATE_RESOURCE))); |
| 56 | + descriptionPanel.add(Box.createVerticalGlue()); |
| 57 | + descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_COPYRIGHT)); |
| 58 | + descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_WEBSITE)); |
59 | 59 |
|
60 | | - JTextPane textLicenses = new JTextPane(); |
61 | | - JScrollPane scrollLicenses = new JScrollPane(textLicenses); |
62 | | - scrollLicenses.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); |
63 | | - textLicenses.setEditable(false); |
| 60 | + JTextPane textLicenses = new JTextPane(); |
| 61 | + JScrollPane scrollLicenses = new JScrollPane(textLicenses); |
| 62 | + scrollLicenses.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); |
| 63 | + textLicenses.setEditable(false); |
64 | 64 |
|
65 | | - java.net.URL helpURL = ClassLoader.getSystemClassLoader().getResource("about.html"); |
66 | | - if (helpURL != null) { |
67 | | - try { |
68 | | - textLicenses.setPage(helpURL); |
69 | | - } catch (IOException e) { |
70 | | - System.err.println("Attempted to read a bad URL: " + helpURL); |
71 | | - } |
72 | | - } else { |
73 | | - System.err.println("Couldn't find file: about.html"); |
74 | | - } |
75 | | - mainPanel.add(scrollLicenses); |
76 | | - // JScrollPane scrollPane = new ScrollPane(textLicenses); |
77 | | - mDialog.pack(); |
78 | | - mDialog.setSize(new Dimension(360, 320)); |
79 | | - mDialog.setLocationRelativeTo(parent); |
80 | | - mDialog.setVisible(true); |
81 | | - } |
| 65 | + java.net.URL helpURL = ClassLoader.getSystemClassLoader().getResource("about.html"); |
| 66 | + if (helpURL != null) { |
| 67 | + try { |
| 68 | + textLicenses.setPage(helpURL); |
| 69 | + } catch (IOException e) { |
| 70 | + System.err.println("Attempted to read a bad URL: " + helpURL); |
| 71 | + } |
| 72 | + } else { |
| 73 | + System.err.println("Couldn't find file: about.html"); |
| 74 | + } |
| 75 | + mainPanel.add(scrollLicenses); |
| 76 | + // JScrollPane scrollPane = new ScrollPane(textLicenses); |
| 77 | + mDialog.pack(); |
| 78 | + mDialog.setSize(new Dimension(360, 320)); |
| 79 | + mDialog.setLocationRelativeTo(parent); |
| 80 | + mDialog.setVisible(true); |
| 81 | +} |
82 | 82 | } |
0 commit comments