About.java
package server.netsiddev;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
public class About extends SIDDeviceStage {
private static final long serialVersionUID = 1L;
/**
* Build date calculated from our own modified time
*/
public static final Calendar LAST_MODIFIED;
static {
try {
URL us = About.class.getProtectionDomain().getCodeSource().getLocation();
LAST_MODIFIED = Calendar.getInstance();
LAST_MODIFIED.setTime(new Date(us.openConnection().getLastModified()));
} catch (IOException e) {
throw new ExceptionInInitializerError(e);
}
}
private final JTextArea credits;
public About() {
credits = new JTextArea();
credits.setEditable(false);
credits.setLineWrap(false);
credits.setHighlighter(null);
credits.setMargin(new Insets(0, 0, 10, 0));
getContentPane().add(credits, BorderLayout.CENTER);
JButton ok = new JButton(util.getBundle().getString("OK"));
ok.addActionListener(this::okPressed);
getContentPane().add(ok, BorderLayout.PAGE_END);
setBackground(Color.WHITE);
getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
setCredits();
}
private void okPressed(ActionEvent event) {
dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
private void setCredits() {
final String javaVersion = System.getProperty("java.runtime.version");
final String creditsText = String.format(getBundle().getString("CREDITS"), LAST_MODIFIED.get(Calendar.YEAR),
javaVersion);
credits.setText(creditsText);
}
}