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