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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.utils.*;
public class AboutWindow
extends SIPCommDialog
implements HyperlinkListener,
ActionListener
{
private WindowBackground mainPanel
= new WindowBackground();
private JLabel titleLabel = new JLabel(
"SIP Communicator");
private JLabel versionLabel = new JLabel(
"version 1.0 alpha1");
private JTextArea logoArea
= new JTextArea("Open source VoIP & Instant messaging");
private JEditorPane rightsArea = new JEditorPane();
private JEditorPane licenseArea = new JEditorPane();
private JButton okButton = new JButton(Messages.getString("ok"));
private JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
private JPanel textPanel = new JPanel();
public AboutWindow(Frame owner)
{
super(owner);
this.setTitle(Messages.getString("about"));
this.setModal(false);
this.mainPanel.setLayout(new BorderLayout());
this.textPanel.setPreferredSize(new Dimension(470, 280));
this.textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS));
this.textPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
this.textPanel.setOpaque(false);
this.titleLabel.setFont(Constants.FONT.deriveFont(Font.BOLD, 28));
this.titleLabel.setForeground(Constants.DARK_BLUE);
this.titleLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
this.versionLabel.setFont(Constants.FONT.deriveFont(Font.BOLD, 18));
this.versionLabel.setForeground(Color.GRAY);
this.versionLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
this.logoArea.setFont(Constants.FONT.deriveFont(Font.BOLD, 14));
this.logoArea.setForeground(Constants.DARK_BLUE);
this.logoArea.setOpaque(false);
this.logoArea.setLineWrap(true);
this.logoArea.setWrapStyleWord(true);
this.logoArea.setEditable(false);
this.logoArea.setPreferredSize(new Dimension(100, 20));
this.logoArea.setAlignmentX(Component.RIGHT_ALIGNMENT);
this.logoArea.setBorder(BorderFactory.createEmptyBorder(30, 180, 0, 0));
this.rightsArea.setContentType("text/html");
this.rightsArea.setText("<html>(c)2003-2006 Copyright <b>sip-communicator.org</b>."
+ " All rights reserved. Visit "
+ "<a href=\"http://sip-communicator.org\">"
+ "http://sip-communicator.org</a>.</html>");
this.rightsArea.setPreferredSize(new Dimension(50, 20));
this.rightsArea.setBorder(BorderFactory.createEmptyBorder(0, 180, 0, 0));
this.rightsArea.setOpaque(false);
this.rightsArea.setEditable(false);
this.rightsArea.setAlignmentX(Component.RIGHT_ALIGNMENT);
this.rightsArea.addHyperlinkListener(this);
this.licenseArea.setContentType("text/html");
this.licenseArea.setText("<html>The <b>SIP Communicator</b> is distributed under the"
+ " terms of the LGPL "
+ "(<a href=\"http://www.gnu.org\">"
+ "http://www.gnu.org</a>).</html>");
this.licenseArea.setPreferredSize(new Dimension(50, 20));
this.licenseArea.setBorder(BorderFactory.createEmptyBorder(10, 180, 0, 0));
this.licenseArea.setOpaque(false);
this.licenseArea.setEditable(false);
this.licenseArea.setAlignmentX(Component.RIGHT_ALIGNMENT);
this.licenseArea.addHyperlinkListener(this);
this.textPanel.add(titleLabel);
this.textPanel.add(versionLabel);
this.textPanel.add(logoArea);
this.textPanel.add(rightsArea);
this.textPanel.add(licenseArea);
this.getRootPane().setDefaultButton(okButton);
this.okButton.addActionListener(this);
this.buttonPanel.add(okButton);
this.buttonPanel.setOpaque(false);
this.mainPanel.add(textPanel, BorderLayout.CENTER);
this.mainPanel.add(buttonPanel, BorderLayout.SOUTH);
this.getContentPane().add(mainPanel);
this.setResizable(false);
}
protected void close(boolean isEscaped)
{}
/**
* Constructs the window background in order to have a background image.
*/
private class WindowBackground extends JPanel {
private Image bgImage
= ImageLoader.getImage(ImageLoader.ABOUT_WINDOW_BACKGROUND);
public WindowBackground() {
this.setPreferredSize(new Dimension(bgImage.getWidth(this), bgImage
.getHeight(this)));
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
AntialiasingManager.activateAntialiasing(g);
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(bgImage, 0, 0, null);
g2.setColor(new Color(255, 255, 255, 100));
g2.fillRect(0, 0, getWidth(), getHeight());
}
}
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
String href = e.getDescription();
CrossPlatformBrowserLauncher.openURL(href);
}
}
public void actionPerformed(ActionEvent e)
{
this.dispose();
}
}
|