6 * (C) Copyright 2001-2004, by Object Refinery Limited.
8 * Original Author: David Gilbert (for Object Refinery Limited);
10 package org
.tsho
.dmc2
.ui
;
12 import java
.awt
.BorderLayout
;
13 import java
.awt
.Dimension
;
14 import java
.awt
.Image
;
15 import java
.util
.Arrays
;
16 import java
.util
.List
;
17 import java
.util
.ResourceBundle
;
19 import javax
.swing
.BorderFactory
;
20 import javax
.swing
.JFrame
;
21 import javax
.swing
.JPanel
;
22 import javax
.swing
.JScrollPane
;
23 import javax
.swing
.JTabbedPane
;
24 import javax
.swing
.JTextArea
;
25 import javax
.swing
.border
.Border
;
27 import org
.jfree
.JCommon
;
28 import org
.jfree
.chart
.JFreeChart
;
29 import org
.jfree
.ui
.about
.AboutFrame
;
30 import org
.jfree
.ui
.about
.Contributor
;
31 import org
.jfree
.ui
.about
.ContributorsPanel
;
32 import org
.jfree
.ui
.about
.Library
;
33 import org
.jfree
.ui
.about
.LibraryPanel
;
34 import org
.jfree
.ui
.about
.Licences
;
35 import org
.jfree
.ui
.about
.ProjectInfo
;
36 import org
.jfree
.ui
.about
.SystemPropertiesPanel
;
37 import org
.tsho
.dmc2
.DmcDue
;
40 public class DmcAboutFrame
extends JFrame
{
42 private static final String myInfo
=
43 "iDMC the interactive Dynamical Model Calculator simulates and performs "
44 + "graphical and numerical analysis of systems of differential and "
45 + "difference equations."
48 + "The software program was developed within a research project financed "
49 + "by the Italian Ministry of Universities, the Universities of Udine and "
50 + "Ca'Foscari of Venice, the Friuli-Venezia Giulia Region.";
55 this("iDmc", new DmcDueInfo());
58 static class DmcDueInfo
extends ProjectInfo
{
61 setName(DmcDue
.Defaults
.name
);
62 setVersion(DmcDue
.Defaults
.version
);
64 setCopyright("Copyright 2004-2007 Marji Lines and Alfredo Medio");
66 setLicenceName("GPL");
67 setLicenceText(Licences
.getInstance().getGPL());
69 setContributors(Arrays
.asList(
71 new Contributor("Daniele Pizzoni", "auouo@tin.it"),
72 new Contributor("Alexei Grigoriev","alexei_grigoriev@libero.it"),
73 new Contributor("Antonio, Fabio Di Narzo", "antonio.fabio@gmail.com")
77 setLibraries(Arrays
.asList(
79 new Library(JFreeChart
.INFO
),
80 new Library(JCommon
.INFO
),
81 new Library("JGoodies Forms", "1.0.3", "BSD", "http://www.jgoodies.com/"),
82 new Library("idmclib", "0.2.0", "GPL", ""),
90 /** The preferred size for the frame. */
91 public static final Dimension PREFERRED_SIZE
= new Dimension(560, 360);
93 /** The default border for the panels in the tabbed pane. */
94 public static final Border STANDARD_BORDER
= BorderFactory
.createEmptyBorder(5, 5, 5, 5);
96 /** Localised resources. */
97 private ResourceBundle resources
;
99 /** The application name. */
100 private String application
;
102 /** The application version. */
103 private String version
;
105 /** The copyright string. */
106 private String copyright
;
108 /** Other info about the application. */
111 /** The project logo. */
114 /** A list of contributors. */
115 private List contributors
;
118 private String licence
;
120 /** A list of libraries. */
121 private List libraries
;
124 * Constructs an about frame.
126 * @param title the frame title.
127 * @param project information about the project.
129 public DmcAboutFrame(String title
, ProjectInfo project
) {
133 "Version " + project
.getVersion(),
136 project
.getCopyright(),
137 project
.getLicenceText(),
138 project
.getContributors(),
139 project
.getLibraries());
144 * Constructs an 'About' frame.
146 * @param title the frame title.
147 * @param application the application name.
148 * @param version the version.
149 * @param info other info.
150 * @param logo an optional logo.
151 * @param copyright the copyright notice.
152 * @param licence the licence.
153 * @param contributors a list of developers/contributors.
154 * @param libraries a list of libraries.
156 public DmcAboutFrame(String title
,
157 String application
, String version
, String info
,
159 String copyright
, String licence
,
165 this.application
= application
;
166 this.version
= version
;
167 this.copyright
= copyright
;
170 this.contributors
= contributors
;
171 this.licence
= licence
;
172 this.libraries
= libraries
;
174 String baseName
= "org.jfree.ui.about.resources.AboutResources";
175 this.resources
= ResourceBundle
.getBundle(baseName
);
177 JPanel content
= new JPanel(new BorderLayout());
178 content
.setBorder(STANDARD_BORDER
);
180 JTabbedPane tabs
= createTabs();
182 setContentPane(content
);
189 * Returns the preferred size for the about frame.
191 * @return the preferred size.
193 public Dimension
getPreferredSize() {
194 return PREFERRED_SIZE
;
198 * Creates a tabbed pane containing an about panel and a system properties panel.
200 * @return a tabbed pane.
202 private JTabbedPane
createTabs() {
204 JTabbedPane tabs
= new JTabbedPane();
206 JPanel aboutPanel
= createAboutPanel();
207 aboutPanel
.setBorder(AboutFrame
.STANDARD_BORDER
);
208 String aboutTab
= this.resources
.getString("about-frame.tab.about");
209 tabs
.add(aboutTab
, aboutPanel
);
211 JPanel systemPanel
= new SystemPropertiesPanel();
212 systemPanel
.setBorder(AboutFrame
.STANDARD_BORDER
);
213 String systemTab
= this.resources
.getString("about-frame.tab.system");
214 tabs
.add(systemTab
, systemPanel
);
221 * Creates a panel showing information about the application, including the name, version,
222 * copyright notice, URL for further information, and a list of contributors.
226 private JPanel
createAboutPanel() {
228 JPanel about
= new JPanel(new BorderLayout());
230 JPanel details
= new DmcAboutPanel(this.application
, this.version
, this.copyright
, this.info
,
233 boolean includetabs
= false;
234 JTabbedPane tabs
= new JTabbedPane();
236 if (this.contributors
!= null) {
237 JPanel contributorsPanel
= new ContributorsPanel(this.contributors
);
238 contributorsPanel
.setBorder(AboutFrame
.STANDARD_BORDER
);
239 String contributorsTab
= this.resources
.getString("about-frame.tab.contributors");
240 tabs
.add(contributorsTab
, contributorsPanel
);
244 if (this.licence
!= null) {
245 JPanel licencePanel
= createLicencePanel();
246 licencePanel
.setBorder(STANDARD_BORDER
);
247 String licenceTab
= this.resources
.getString("about-frame.tab.licence");
248 tabs
.add(licenceTab
, licencePanel
);
252 if (this.libraries
!= null) {
253 JPanel librariesPanel
= new LibraryPanel(this.libraries
);
254 librariesPanel
.setBorder(AboutFrame
.STANDARD_BORDER
);
255 String librariesTab
= this.resources
.getString("about-frame.tab.libraries");
256 tabs
.add(librariesTab
, librariesPanel
);
260 about
.add(details
, BorderLayout
.NORTH
);
270 * Creates a panel showing the licence.
274 private JPanel
createLicencePanel() {
276 JPanel licencePanel
= new JPanel(new BorderLayout());
277 JTextArea area
= new JTextArea(this.licence
);
278 area
.setLineWrap(true);
279 area
.setWrapStyleWord(true);
280 area
.setCaretPosition(0);
281 area
.setEditable(false);
282 licencePanel
.add(new JScrollPane(area
));