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

70 lines
2.3 KiB
Java
Raw Normal View History

package view.panels;
import javax.imageio.ImageIO;
import javax.swing.*;
2017-11-01 13:04:43 +00:00
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;
/**
* 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 {
2017-11-01 13:04:43 +00:00
private JTextPane textArea;
private JLabel imageContainer;
private JPanel contentPane;
private ImageIcon image;
2017-10-17 06:34:55 +00:00
/**
* Konstruktor
*/
public AboutPanel() {
super();
this.setSize(new Dimension(410, 400));
this.setLayout(new BorderLayout());
contentPane = new JPanel(new BorderLayout());
2017-11-01 13:04:43 +00:00
this.textArea = new JTextPane();
this.textArea.setEditable(false);
2017-11-01 13:04:43 +00:00
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) {
e.printStackTrace();
}
doc.setParagraphAttributes(0,doc.getLength()-1,attrs,false);
contentPane.add(this.textArea, BorderLayout.CENTER);
ClassLoader classLoader = getClass().getClassLoader();
try {
image = new ImageIcon(ImageIO.read(classLoader.getResource("wwu.png")).getScaledInstance(300, 87, Image.SCALE_SMOOTH));
} catch (IOException e) {
e.printStackTrace();
}
this.imageContainer = new JLabel(image);
contentPane.add(imageContainer, BorderLayout.NORTH);
this.add(new JPanel(), BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
this.setVisible(true);
}
}