19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.Cursor;
22 import java.awt.Desktop;
23 import java.awt.Window;
25 import java.io.IOException;
26 import java.net.MalformedURLException;
27 import java.net.URISyntaxException;
29 import java.text.MessageFormat;
30 import java.util.Locale;
31 import java.util.logging.Level;
32 import javax.swing.Icon;
33 import javax.swing.ImageIcon;
34 import javax.swing.JPanel;
35 import javax.swing.SwingUtilities;
36 import javax.swing.event.HyperlinkEvent;
37 import javax.swing.event.HyperlinkListener;
38 import org.netbeans.core.actions.HTMLViewAction;
39 import org.openide.modules.Places;
40 import org.openide.util.ImageUtilities;
41 import org.openide.util.NbBundle;
50 @SuppressWarnings(
"PMD.SingularField")
53 private static final long serialVersionUID = 1L;
55 private URL url = null;
60 about =
new ImageIcon(ImageUtilities.loadImage(
"org/sleuthkit/autopsy/images/splash.png"));
65 about =
new ImageIcon(ImageUtilities.loadImage(pathToBrandingImage));
71 logoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
73 "LBL_Description",
new Object[]{getProductVersionValue(), getJavaValue(), getVMValue(),
74 getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), getSleuthKitVersionValue(), Version.getNetbeansBuild(), Version.getBuildType().toString()}));
75 copyright.setBackground(getBackground());
76 if (verboseLoggingIsSet()) {
77 disableVerboseLoggingButton();
81 copyright.addHyperlinkListener(hyperlinkListener);
82 description.addHyperlinkListener(hyperlinkListener);
91 if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED
92 && Desktop.isDesktopSupported()) {
95 Desktop.getDesktop().browse(e.getURL().toURI());
96 }
catch (IOException | URISyntaxException ex) {
97 logger.log(Level.WARNING,
"Failed to display URL in external viewer", ex);
106 logoLabel =
new javax.swing.JLabel();
107 jScrollPane3 =
new javax.swing.JScrollPane();
108 copyright =
new javax.swing.JTextPane();
109 jScrollPane2 =
new javax.swing.JScrollPane();
110 description =
new javax.swing.JTextPane();
111 verboseLoggingButton =
new javax.swing.JButton();
112 jButton2 =
new javax.swing.JButton();
114 setBackground(
new java.awt.Color(255, 255, 255));
116 logoLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
117 logoLabel.setIcon(about);
118 logoLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
119 logoLabel.addMouseListener(
new java.awt.event.MouseAdapter() {
120 public void mouseClicked(java.awt.event.MouseEvent evt) {
121 logoLabelMouseClicked(evt);
125 jScrollPane3.setBorder(null);
127 copyright.setEditable(
false);
128 copyright.setBorder(null);
129 copyright.setContentType(
"text/html");
130 copyright.setText(
org.openide.util.NbBundle.getBundle(
AboutWindowPanel.class).getString(
"LBL_Copyright"));
131 copyright.addMouseListener(
new java.awt.event.MouseAdapter() {
132 public void mouseClicked(java.awt.event.MouseEvent evt) {
133 copyrightMouseClicked(evt);
136 jScrollPane3.setViewportView(copyright);
138 description.setEditable(
false);
139 description.setContentType(
"text/html");
140 jScrollPane2.setViewportView(description);
142 verboseLoggingButton.setBackground(
new java.awt.Color(255, 255, 255));
143 verboseLoggingButton.setText(
"Activate verbose logging");
144 verboseLoggingButton.addActionListener(
new java.awt.event.ActionListener() {
145 public void actionPerformed(java.awt.event.ActionEvent evt) {
146 activateVerboseLogging(evt);
150 jButton2.setBackground(
new java.awt.Color(255, 255, 255));
152 jButton2.addActionListener(
new java.awt.event.ActionListener() {
153 public void actionPerformed(java.awt.event.ActionEvent evt) {
154 jButton2ActionPerformed(evt);
158 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
159 this.setLayout(layout);
160 layout.setHorizontalGroup(
161 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
162 .addGroup(layout.createSequentialGroup()
164 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
165 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
166 .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
167 .addComponent(logoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
168 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
169 .addGap(0, 0, Short.MAX_VALUE)
170 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
171 .addComponent(verboseLoggingButton, javax.swing.GroupLayout.Alignment.TRAILING)
172 .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING))))
175 layout.setVerticalGroup(
176 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
177 .addGroup(layout.createSequentialGroup()
179 .addComponent(logoLabel)
180 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
181 .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
182 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
183 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
184 .addGap(18, 18, Short.MAX_VALUE)
185 .addComponent(verboseLoggingButton)
187 .addComponent(jButton2)
204 }
catch (MalformedURLException ex) {
211 startVerboseLogging();
212 disableVerboseLoggingButton();
225 this.verboseLoggingButton.setEnabled(
false);
226 this.verboseLoggingButton.setText(
227 NbBundle.getMessage(
this.getClass(),
"ProductInformationPanel.verbLoggingEnabled.text"));
231 Window w = SwingUtilities.getWindowAncestor(
this);
238 org.openide.awt.StatusDisplayer.getDefault().setStatusText(
239 NbBundle.getMessage(HTMLViewAction.class,
"CTL_OpeningBrowser"));
241 if(Desktop.isDesktopSupported()) {
243 Desktop.getDesktop().browse(url.toURI());
244 }
catch (IOException | URISyntaxException ex) {
245 logger.log(Level.WARNING,
"Failed to display URL in external viewer", ex);
252 return SleuthkitJNI.getVersion();
256 return MessageFormat.format(
257 NbBundle.getBundle(
"org.netbeans.core.startup.Bundle").getString(
"currentVersion"),
258 new Object[]{System.getProperty(
"netbeans.buildnumber")});
262 return NbBundle.getMessage(
AboutWindowPanel.class,
"Format_OperatingSystem_Value",
263 System.getProperty(
"os.name",
265 "ProductInformationPanel.propertyUnknown.text")),
266 System.getProperty(
"os.version",
268 "ProductInformationPanel.propertyUnknown.text")),
269 System.getProperty(
"os.arch",
271 "ProductInformationPanel.propertyUnknown.text")));
275 return System.getProperty(
"java.version",
277 "ProductInformationPanel.propertyUnknown.text"));
282 "ProductInformationPanel.getVMValue.text",
283 System.getProperty(
"java.vm.name",
285 "ProductInformationPanel.propertyUnknown.text")),
286 System.getProperty(
"java.vm.version",
""));
291 return Locale.getDefault().toString() + ((branding = NbBundle.getBranding()) == null ?
"" : (
" (" + branding +
")"));
295 return Places.getUserDirectory().getAbsolutePath();
299 return System.getProperty(
"file.encoding",
300 NbBundle.getMessage(
AboutWindowPanel.class,
"ProductInformationPanel.propertyUnknown.text"));
304 copyright.setText(text);
309 if (HyperlinkEvent.EventType.ENTERED == event.getEventType()) {
310 url =
event.getURL();
311 }
else if (HyperlinkEvent.EventType.EXITED == event.getEventType()) {
320 verboseLogging =
true;
323 SleuthkitJNI.startVerboseLogging(logPath);
332 return verboseLogging;
void hyperlinkUpdate(HyperlinkEvent e)
javax.swing.JTextPane copyright
static String getVMValue()
void disableVerboseLoggingButton()
static String getProductVersionValue()
static String getJavaValue()
AboutWindowPanel(String pathToBrandingImage)
static String getOperatingSystemValue()
void logoLabelMouseClicked(java.awt.event.MouseEvent evt)
javax.swing.JTextPane description
static String getEncodingValue()
boolean verboseLoggingIsSet()
javax.swing.JScrollPane jScrollPane2
void hyperlinkUpdate(HyperlinkEvent event)
javax.swing.JButton jButton2
void activateVerboseLogging(java.awt.event.ActionEvent evt)
javax.swing.JLabel logoLabel
void copyrightMouseClicked(java.awt.event.MouseEvent evt)
synchronized static Logger getLogger(String name)
javax.swing.JButton verboseLoggingButton
void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
void startVerboseLogging()
static String getSleuthKitVersionValue()
javax.swing.JScrollPane jScrollPane3
void setCopyright(String text)
static String getSystemLocaleValue()