algorithms-for-computing-li.../LinearRegressionTool/src/main/java/de/wwwu/awolf/view/panels/AboutPanel.java

73 lines
2.5 KiB
Java

package de.wwwu.awolf.view.panels;
import de.wwwu.awolf.presenter.util.Logging;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import java.awt.*;
import java.io.IOException;
import java.util.Objects;
/**
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
*
* @Author: Armin Wolf
* @Email: a_wolf28@uni-muenster.de
* @Date: 10.09.2017.
*/
public class AboutPanel extends JPanel {
private JTextPane textArea;
private JLabel imageContainer;
private JPanel contentPane;
private ImageIcon image;
/**
* Konstruktor
*/
public AboutPanel() {
super();
this.setSize(new Dimension(410, 400));
this.setLayout(new BorderLayout());
contentPane = new JPanel(new BorderLayout());
this.textArea = new JTextPane();
this.textArea.setEditable(false);
this.textArea.setOpaque(false);
SimpleAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setAlignment(attrs, StyleConstants.ALIGN_CENTER);
StyleConstants.setBackground(new SimpleAttributeSet(), new Color(255, 255, 255, 128));
StyledDocument doc = (StyledDocument) textArea.getDocument();
String text = "\n\n\n\nDiese Software wurde als praktischer Teil der Masterarbeit:\n" +
"\"Algorithmen zur Berechnung von Ausgleichsgeraden\"\n" +
"entwickelt.\n\n" +
" Armin Wolf\n a_wolf28@uni-muenster.de\n" +
"Matrikelnummer: 398214";
try {
doc.insertString(0, text, attrs);
} catch (BadLocationException e) {
Logging.logError(e.getMessage(), e);
}
doc.setParagraphAttributes(0, doc.getLength() - 1, attrs, false);
contentPane.add(this.textArea, BorderLayout.CENTER);
ClassLoader classLoader = getClass().getClassLoader();
try {
image = new ImageIcon(ImageIO.read(Objects.requireNonNull(classLoader.getResource("wwu.png"))).getScaledInstance(300, 87, Image.SCALE_SMOOTH));
} catch (IOException e) {
Logging.logError(e.getMessage(), e);
}
this.imageContainer = new JLabel(image);
contentPane.add(imageContainer, BorderLayout.NORTH);
this.add(new JPanel(), BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
this.setVisible(true);
}
}