| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AboutDialog |
|
| 1.4444444444444444;1.444 |
| 1 | /****************************************************************************** | |
| 2 | * AboutDialog.java - Display the license | |
| 3 | * $Id$ | |
| 4 | * | |
| 5 | * BuckoFIBS - Backgammon by BuckoSoft | |
| 6 | * Copyright© 2009,2010 - Dick Balaska - BuckoSoft, Corp. | |
| 7 | * | |
| 8 | * $Log$ | |
| 9 | * Revision 1.2 2010/03/03 12:19:49 inim | |
| 10 | * Moved source to UTF8 encoding from CP1252 encoding. To this end all source files' (c) message was updated to "Copyright© 2009,2010 - Dick Balaska - BuckoSoft, Corp.". This replaces the (c) sign to UTF8, and adds the new year 2010. | |
| 11 | * | |
| 12 | * Revision 1.1 2010/02/04 05:57:53 inim | |
| 13 | * Mavenized project folder layout | |
| 14 | * | |
| 15 | * Revision 1.1 2009/02/14 12:20:45 dick | |
| 16 | * Display the license. | |
| 17 | * | |
| 18 | */ | |
| 19 | ||
| 20 | /* | |
| 21 | * This program is free software: you can redistribute it and/or modify | |
| 22 | * it under the terms of the GNU General Public License as published by | |
| 23 | * the Free Software Foundation, either version 3 of the License, or | |
| 24 | * (at your option) any later version. | |
| 25 | * | |
| 26 | * This program is distributed in the hope that it will be useful, | |
| 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 29 | * GNU General Public License for more details. | |
| 30 | * | |
| 31 | * You should have received a copy of the GNU General Public License | |
| 32 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 33 | * | |
| 34 | * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>. | |
| 35 | * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp. | |
| 36 | * | |
| 37 | */ | |
| 38 | package com.buckosoft.fibs.BuckoFIBS.gui; | |
| 39 | ||
| 40 | import java.awt.Dialog; | |
| 41 | import java.awt.Font; | |
| 42 | import java.awt.Frame; | |
| 43 | import java.awt.GridBagConstraints; | |
| 44 | import java.awt.GridBagLayout; | |
| 45 | import java.awt.Insets; | |
| 46 | import java.io.IOException; | |
| 47 | ||
| 48 | import javax.swing.JDialog; | |
| 49 | import javax.swing.JEditorPane; | |
| 50 | import javax.swing.JLabel; | |
| 51 | import javax.swing.JPanel; | |
| 52 | import javax.swing.JScrollPane; | |
| 53 | ||
| 54 | /** Display the license | |
| 55 | * @author Dick Balaska | |
| 56 | * @since 2009/02/14 | |
| 57 | * @version $Revision$ <br> $Date$ | |
| 58 | * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/com/buckosoft/fibs/BuckoFIBS/gui/AboutDialog.java">cvs AboutDialog.java</a> | |
| 59 | */ | |
| 60 | public class AboutDialog extends JDialog { | |
| 61 | ||
| 62 | private static final long serialVersionUID = 1L; | |
| 63 | 0 | private JPanel jContentPane = null; |
| 64 | 0 | private JLabel jLabelTitle = null; |
| 65 | 0 | private JEditorPane jEditorPaneLicense = null; |
| 66 | 0 | private JScrollPane jScrollPaneLicense = null; |
| 67 | 0 | private JLabel jLabel = null; |
| 68 | 0 | private JLabel jLabelHope = null; |
| 69 | ||
| 70 | /** Default constructor | |
| 71 | * | |
| 72 | */ | |
| 73 | public AboutDialog() { | |
| 74 | 0 | super(); |
| 75 | 0 | initialize(); |
| 76 | 0 | } |
| 77 | ||
| 78 | /** Construct the AboutDialog centered over a Frame | |
| 79 | * @param arg0 | |
| 80 | */ | |
| 81 | public AboutDialog(Frame arg0) { | |
| 82 | 0 | super(arg0); |
| 83 | 0 | initialize(); |
| 84 | 0 | this.setLocationRelativeTo(arg0); |
| 85 | 0 | } |
| 86 | ||
| 87 | /** Construct the AboutDialog centered over a Dialog | |
| 88 | * @param arg0 | |
| 89 | */ | |
| 90 | public AboutDialog(Dialog arg0) { | |
| 91 | 0 | super(arg0); |
| 92 | 0 | initialize(); |
| 93 | 0 | this.setLocationRelativeTo(arg0); |
| 94 | 0 | } |
| 95 | ||
| 96 | /** Display the AboutDialog | |
| 97 | * @param args None that i know of | |
| 98 | */ | |
| 99 | public static void main(String[] args) { | |
| 100 | 0 | AboutDialog aboutDialog = new AboutDialog(); |
| 101 | 0 | aboutDialog.setVisible(true); |
| 102 | 0 | } |
| 103 | ||
| 104 | /** Set the version number to display in the dialog. | |
| 105 | * @param version The version as "0.1" | |
| 106 | */ | |
| 107 | public void setVersion(String version) { | |
| 108 | 0 | this.setTitle("About BuckoFIBS-" + version); |
| 109 | 0 | this.jLabelTitle.setText("BuckoFIBS-" + version); |
| 110 | 0 | } |
| 111 | ||
| 112 | /** | |
| 113 | * This method initializes jEditorPaneLicense | |
| 114 | * | |
| 115 | * @return javax.swing.JEditorPane | |
| 116 | */ | |
| 117 | private JEditorPane getJEditorPaneLicense() { | |
| 118 | 0 | if (jEditorPaneLicense == null) { |
| 119 | 0 | jEditorPaneLicense = new JEditorPane(); |
| 120 | try { | |
| 121 | 0 | jEditorPaneLicense.setPage(getClass().getResource("/LICENSE.html")); |
| 122 | 0 | jEditorPaneLicense.setEditable(false); |
| 123 | 0 | } catch (IOException e) { |
| 124 | 0 | e.printStackTrace(); |
| 125 | 0 | } |
| 126 | } | |
| 127 | 0 | return jEditorPaneLicense; |
| 128 | } | |
| 129 | ||
| 130 | /** | |
| 131 | * This method initializes jScrollPaneLicense | |
| 132 | * | |
| 133 | * @return javax.swing.JScrollPane | |
| 134 | */ | |
| 135 | private JScrollPane getJScrollPaneLicense() { | |
| 136 | 0 | if (jScrollPaneLicense == null) { |
| 137 | 0 | jScrollPaneLicense = new JScrollPane(); |
| 138 | 0 | jScrollPaneLicense.setViewportView(getJEditorPaneLicense()); |
| 139 | } | |
| 140 | 0 | return jScrollPaneLicense; |
| 141 | } | |
| 142 | ||
| 143 | /** | |
| 144 | * This method initializes this | |
| 145 | * | |
| 146 | * @return void | |
| 147 | */ | |
| 148 | private void initialize() { | |
| 149 | 0 | this.setSize(717, 330); |
| 150 | 0 | this.setTitle("About BuckoFIBS-X.X"); |
| 151 | 0 | this.setContentPane(getJContentPane()); |
| 152 | 0 | } |
| 153 | ||
| 154 | /** | |
| 155 | * This method initializes jContentPane | |
| 156 | * | |
| 157 | * @return javax.swing.JPanel | |
| 158 | */ | |
| 159 | private JPanel getJContentPane() { | |
| 160 | 0 | if (jContentPane == null) { |
| 161 | 0 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
| 162 | 0 | gridBagConstraints4.gridx = 0; |
| 163 | 0 | gridBagConstraints4.gridy = 2; |
| 164 | 0 | jLabelHope = new JLabel(); |
| 165 | 0 | jLabelHope.setText("It is the hope and desire of the original author that any changes or improvements you make are reflected back to the original program."); |
| 166 | 0 | jLabelHope.setFont(new Font("Dialog", Font.PLAIN, 10)); |
| 167 | 0 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
| 168 | 0 | gridBagConstraints3.gridx = 0; |
| 169 | 0 | gridBagConstraints3.anchor = GridBagConstraints.WEST; |
| 170 | 0 | gridBagConstraints3.weighty = 0.0; |
| 171 | 0 | gridBagConstraints3.insets = new Insets(0, 0, 5, 0); |
| 172 | 0 | gridBagConstraints3.gridy = 1; |
| 173 | 0 | jLabel = new JLabel(); |
| 174 | 0 | jLabel.setText("Copyright© 2009 Dick Balaska & BuckoSoft, Corp."); |
| 175 | 0 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
| 176 | 0 | gridBagConstraints2.fill = GridBagConstraints.BOTH; |
| 177 | 0 | gridBagConstraints2.gridy = 3; |
| 178 | 0 | gridBagConstraints2.weightx = 1.0; |
| 179 | 0 | gridBagConstraints2.weighty = 1.0; |
| 180 | 0 | gridBagConstraints2.gridx = 0; |
| 181 | 0 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
| 182 | 0 | gridBagConstraints.insets = new Insets(7, 0, 0, 0); |
| 183 | 0 | gridBagConstraints.gridy = 0; |
| 184 | 0 | gridBagConstraints.ipadx = 0; |
| 185 | 0 | gridBagConstraints.weighty = 0.0; |
| 186 | 0 | gridBagConstraints.anchor = GridBagConstraints.NORTH; |
| 187 | 0 | gridBagConstraints.gridx = 0; |
| 188 | 0 | jLabelTitle = new JLabel(); |
| 189 | 0 | jLabelTitle.setText("BuckoFIBS-X.X"); |
| 190 | 0 | jContentPane = new JPanel(); |
| 191 | 0 | jContentPane.setLayout(new GridBagLayout()); |
| 192 | 0 | jContentPane.add(jLabelTitle, gridBagConstraints); |
| 193 | 0 | jContentPane.add(getJScrollPaneLicense(), gridBagConstraints2); |
| 194 | 0 | jContentPane.add(jLabel, gridBagConstraints3); |
| 195 | 0 | jContentPane.add(jLabelHope, gridBagConstraints4); |
| 196 | } | |
| 197 | 0 | return jContentPane; |
| 198 | } | |
| 199 | ||
| 200 | } // @jve:decl-index=0:visual-constraint="10,10" |