AboutWindow.java~
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package org.mote.wiimote.whiteboard.gui;
import java.awt.BorderLayout;
import java.awt.Font;
import java.net.URL;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import net.miginfocom.swing.MigLayout;
import org.jdesktop.application.Action;
import org.jdesktop.application.Application;
import org.mote.wiimote.whiteboard.WiimoteWhiteboard;
import org.mote.wiimote.whiteboard.util.BareBonesBrowserLaunch;
import org.mote.wiimote.whiteboard.util.Util;
@SuppressWarnings("serial")
public class AboutWindow extends JDialog implements HyperlinkListener {
public AboutWindow() {
super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame());
if (!Util.INSIDE_APP_BUNDLE) {
setName("aboutWindow");
setLayout(new BorderLayout());
final JPanel appPane = Util.newComponent(JPanel.class, "appPane");
add(appPane, BorderLayout.NORTH);
appPane.setLayout(new MigLayout("insets i", "[center|center]"));
JLabel appLabel = new JLabel(String.format("%s %s", WiimoteWhiteboard.getProperty("id"), WiimoteWhiteboard.getProperty("version")));
appLabel.setFont(appLabel.getFont().deriveFont(Font.BOLD, 14f));
JLabel crLabel = new JLabel(Util.getResourceMap(AboutWindow.class).getString("copyRight", WiimoteWhiteboard.getProperty("year"), WiimoteWhiteboard.getProperty("author")));
crLabel.setFont(appLabel.getFont().deriveFont(10f));
appPane.add(appLabel, "flowy, split 2");
appPane.add(crLabel, "");
appPane.add(new JLabel(Util.getResourceMap(WiimoteWhiteboard.class).getImageIcon("icon")), "flowx, wrap");
try {
URL url = AboutWindow.class.getResource("resources/Credits.html");
JEditorPane tp = Util.newComponent(JEditorPane.class, "infoPane");
tp.addHyperlinkListener(this);
tp.setPage(url);
add(new JScrollPane(tp), BorderLayout.CENTER);
Util.getResourceMap(AboutWindow.class).injectComponents(this);
setResizable(false);
Util.placeDialogWindow(this, 295, 348);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
BareBonesBrowserLaunch.openURL(e.getURL().toString());
}
}
@Action
public void about() {
setVisible(true);
}
}