1:
51:
52: package ;
53:
54: import ;
55: import ;
56: import ;
57: import ;
58: import ;
59:
60: import ;
61: import ;
62: import ;
63: import ;
64: import ;
65: import ;
66: import ;
67:
68: import ;
69:
70:
75: public class AboutFrame extends JFrame {
76:
77:
78: public static final Dimension PREFERRED_SIZE = new Dimension(560, 360);
79:
80:
81: public static final Border STANDARD_BORDER
82: = BorderFactory.createEmptyBorder(5, 5, 5, 5);
83:
84:
85: private ResourceBundle resources;
86:
87:
88: private String application;
89:
90:
91: private String version;
92:
93:
94: private String copyright;
95:
96:
97: private String info;
98:
99:
100: private Image logo;
101:
102:
103: private List contributors;
104:
105:
106: private String licence;
107:
108:
114: public AboutFrame(final String title, final ProjectInfo project) {
115:
116: this(title,
117: project.getName(),
118: "Version " + project.getVersion(),
119: project.getInfo(),
120: project.getLogo(),
121: project.getCopyright(),
122: project.getLicenceText(),
123: project.getContributors(),
124: project);
125:
126: }
127:
128:
141: public AboutFrame(final String title,
142: final String application, final String version,
143: final String info,
144: final Image logo,
145: final String copyright, final String licence,
146: final List contributors,
147: final ProjectInfo project) {
148:
149: super(title);
150:
151: this.application = application;
152: this.version = version;
153: this.copyright = copyright;
154: this.info = info;
155: this.logo = logo;
156: this.contributors = contributors;
157: this.licence = licence;
158:
159: final String baseName = "org.jfree.ui.about.resources.AboutResources";
160: this.resources = ResourceBundleWrapper.getBundle(baseName);
161:
162: final JPanel content = new JPanel(new BorderLayout());
163: content.setBorder(STANDARD_BORDER);
164:
165: final JTabbedPane tabs = createTabs(project);
166: content.add(tabs);
167: setContentPane(content);
168:
169: pack();
170:
171: }
172:
173:
178: public Dimension getPreferredSize() {
179: return PREFERRED_SIZE;
180: }
181:
182:
189: private JTabbedPane createTabs(final ProjectInfo project) {
190:
191: final JTabbedPane tabs = new JTabbedPane();
192:
193: final JPanel aboutPanel = createAboutPanel(project);
194: aboutPanel.setBorder(AboutFrame.STANDARD_BORDER);
195: final String aboutTab = this.resources.getString(
196: "about-frame.tab.about");
197: tabs.add(aboutTab, aboutPanel);
198:
199: final JPanel systemPanel = new SystemPropertiesPanel();
200: systemPanel.setBorder(AboutFrame.STANDARD_BORDER);
201: final String systemTab = this.resources.getString(
202: "about-frame.tab.system");
203: tabs.add(systemTab, systemPanel);
204:
205: return tabs;
206:
207: }
208:
209:
218: private JPanel createAboutPanel(final ProjectInfo project) {
219:
220: final JPanel about = new JPanel(new BorderLayout());
221:
222: final JPanel details = new AboutPanel(this.application, this.version,
223: this.copyright, this.info, this.logo);
224:
225: boolean includetabs = false;
226: final JTabbedPane tabs = new JTabbedPane();
227:
228: if (this.contributors != null) {
229: final JPanel contributorsPanel = new ContributorsPanel(
230: this.contributors);
231: contributorsPanel.setBorder(AboutFrame.STANDARD_BORDER);
232: final String contributorsTab = this.resources.getString(
233: "about-frame.tab.contributors");
234: tabs.add(contributorsTab, contributorsPanel);
235: includetabs = true;
236: }
237:
238: if (this.licence != null) {
239: final JPanel licencePanel = createLicencePanel();
240: licencePanel.setBorder(STANDARD_BORDER);
241: final String licenceTab = this.resources.getString(
242: "about-frame.tab.licence");
243: tabs.add(licenceTab, licencePanel);
244: includetabs = true;
245: }
246:
247: if (project != null) {
248: final JPanel librariesPanel = new LibraryPanel(project);
249: librariesPanel.setBorder(AboutFrame.STANDARD_BORDER);
250: final String librariesTab = this.resources.getString(
251: "about-frame.tab.libraries");
252: tabs.add(librariesTab, librariesPanel);
253: includetabs = true;
254: }
255:
256: about.add(details, BorderLayout.NORTH);
257: if (includetabs) {
258: about.add(tabs);
259: }
260:
261: return about;
262:
263: }
264:
265:
270: private JPanel createLicencePanel() {
271:
272: final JPanel licencePanel = new JPanel(new BorderLayout());
273: final JTextArea area = new JTextArea(this.licence);
274: area.setLineWrap(true);
275: area.setWrapStyleWord(true);
276: area.setCaretPosition(0);
277: area.setEditable(false);
278: licencePanel.add(new JScrollPane(area));
279: return licencePanel;
280:
281: }
282:
283:
284: }