1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.jeuclid.app.mathviewer;
20
21 import java.awt.BorderLayout;
22 import java.awt.Font;
23 import java.awt.Frame;
24 import java.awt.event.KeyAdapter;
25 import java.awt.event.KeyEvent;
26
27 import javax.swing.ImageIcon;
28 import javax.swing.JDialog;
29 import javax.swing.JLabel;
30 import javax.swing.JOptionPane;
31 import javax.swing.JPanel;
32 import javax.swing.SwingConstants;
33
34 import net.sourceforge.jeuclid.LayoutContext;
35
36
37
38
39
40
41 public final class AboutDialog extends JDialog {
42
43 private static final int LARGE_FONT = 14;
44
45 private static final int SMALL_FONT = 12;
46
47 private static final String ABOUT_FONT = "SansSerif";
48
49 private static final long serialVersionUID = 1L;
50
51 private JPanel jContentPane;
52
53 private JLabel iconLabel;
54
55 private JLabel jeuclidLabel;
56
57 private JLabel wwwLabel;
58
59
60
61
62
63 public AboutDialog(final Frame owner) {
64 super(owner);
65 this.initialize();
66 }
67
68
69
70
71
72
73 private void initialize() {
74 this.setModal(true);
75 this.setResizable(false);
76 this.setContentPane(this.getJContentPane());
77 this.setTitle(Messages.getString("MathViewer.aboutWindowTitle"));
78 this.addKeyListener(new KeyAdapter() {
79 @Override
80 public void keyPressed(final KeyEvent e) {
81 if (e.getKeyCode() == KeyEvent.VK_V && e.isAltDown()) {
82 JOptionPane.showMessageDialog(AboutDialog.this,
83 "Version: "
84 + LayoutContext.class.getPackage()
85 .getImplementationVersion());
86 }
87 }
88 });
89 }
90
91
92
93
94
95
96 private JPanel getJContentPane() {
97 if (this.jContentPane == null) {
98 this.wwwLabel = new JLabel();
99 this.wwwLabel.setText(" http://jeuclid.sourceforge.net ");
100 this.wwwLabel.setFont(new Font(AboutDialog.ABOUT_FONT,
101 Font.PLAIN, AboutDialog.SMALL_FONT));
102 this.wwwLabel.setHorizontalAlignment(SwingConstants.CENTER);
103 this.jeuclidLabel = new JLabel();
104 this.jeuclidLabel.setText("JEuclid MathViewer");
105 this.jeuclidLabel.setHorizontalAlignment(SwingConstants.CENTER);
106 this.jeuclidLabel.setFont(new Font(AboutDialog.ABOUT_FONT,
107 Font.BOLD, AboutDialog.LARGE_FONT));
108 this.iconLabel = new JLabel();
109 this.iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
110 this.iconLabel.setIcon(new ImageIcon(this.getClass().getResource(
111 "/icons/jeuclid_128x128.png")));
112 this.jContentPane = new JPanel();
113 this.jContentPane.setLayout(new BorderLayout());
114 this.jContentPane.add(this.iconLabel, BorderLayout.NORTH);
115 this.jContentPane.add(this.jeuclidLabel, BorderLayout.CENTER);
116 this.jContentPane.add(this.wwwLabel, BorderLayout.SOUTH);
117 }
118 return this.jContentPane;
119 }
120
121 }