analyseWriter/src/fenetres/about.java

150 lines
5.4 KiB
Java
Raw Normal View History

2022-06-19 21:01:30 +02:00
package fenetres;
2022-05-24 18:25:41 +02:00
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
2022-05-24 18:25:41 +02:00
import javax.swing.ImageIcon;
import javax.swing.JButton;
2022-05-24 18:25:41 +02:00
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
2022-05-24 18:25:41 +02:00
import MEPTL.commandes;
import java.awt.Color;
2022-05-24 18:25:41 +02:00
2022-06-19 21:01:30 +02:00
public final class about extends JFrame {
private static about instance;
2022-05-24 18:25:41 +02:00
2022-05-25 09:30:49 +02:00
/**
*
*/
private static final long serialVersionUID = 1L;
2022-05-24 18:25:41 +02:00
/**
* Create the application.
*/
public about() {
initialize();
setVisible(true);
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
setResizable(false);
setTitle(commandes.Titre);
setLocation(100, 100);
2022-06-09 09:13:46 +02:00
setSize(518,415);
int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight();
setLocation(( (screenWidth) - getWidth()) / 2, (screenHeight - getHeight()) / 2);
2022-05-24 18:25:41 +02:00
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
setIconImage(img.getImage());
JPanel contentPane = (JPanel) getContentPane();
JLabel lblNewLabelTitre = new JLabel();
ImageIcon img2 = new ImageIcon(getClass().getResource("/accueil.png") );
if(commandes.newVersion) {
img2 = new ImageIcon(getClass().getResource("/resources/accueil_new_version.png") );
}
2022-05-24 18:25:41 +02:00
lblNewLabelTitre.setIcon(img2);
lblNewLabelTitre.setHorizontalAlignment(SwingConstants.LEFT);
lblNewLabelTitre.setFont(new Font("Pacifico", Font.PLAIN, 26));
lblNewLabelTitre.setBounds(0, 0, 502, 100);
2022-05-24 18:25:41 +02:00
contentPane.add(lblNewLabelTitre);
JLabel lblNewLabelVersion = new JLabel("<HTML><B><U>Version :</U></B> " + commandes.version + " "+ commandes.nomDeLaBranch + "</HTML>");
2022-05-24 18:25:41 +02:00
lblNewLabelVersion.setFont(new Font("Tahoma", Font.PLAIN, 16));
lblNewLabelVersion.setBounds(20, 100, 240, 20);
2022-05-24 18:25:41 +02:00
contentPane.add(lblNewLabelVersion);
JLabel lblNewLabelAnnee = new JLabel("<HTML><B><U>Année :</U></B> " + commandes.Annee + "</HTML>");
lblNewLabelAnnee.setFont(new Font("Tahoma", Font.PLAIN, 16));
lblNewLabelAnnee.setBounds(20, 120, 240, 20);
2022-05-24 18:25:41 +02:00
contentPane.add(lblNewLabelAnnee);
2022-12-08 21:35:00 +01:00
JLabel lblCredit = new JLabel("<HTML><U>Crédit</U></HTML>");
2022-05-24 18:25:41 +02:00
lblCredit.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14));
2022-06-09 09:13:46 +02:00
lblCredit.setBounds(20, 268, 60, 20);
2022-05-24 18:25:41 +02:00
getContentPane().add(lblCredit);
2022-12-08 21:35:00 +01:00
JLabel lblNewLabelAuteur = new JLabel("Auteur : Pablo Rodriguez");
2022-05-24 18:25:41 +02:00
lblNewLabelAuteur.setFont(new Font("Tahoma", Font.PLAIN, 14));
2022-06-09 09:13:46 +02:00
lblNewLabelAuteur.setBounds(20, 286, 240, 20);
2022-05-24 18:25:41 +02:00
contentPane.add(lblNewLabelAuteur);
JLabel lblInformationEnseignant = new JLabel("Enseignants à l'université d'Artois");
2022-05-24 18:25:41 +02:00
lblInformationEnseignant.setFont(new Font("Tahoma", Font.PLAIN, 12));
2022-06-09 09:13:46 +02:00
lblInformationEnseignant.setBounds(20, 299, 296, 20);
2022-05-24 18:25:41 +02:00
getContentPane().add(lblInformationEnseignant);
JLabel lblCommentaire = new JLabel("<HTML>Outil permettant lévaluation des fichiers réalisés par des étudiants avec un traitement de texte au format ODF.</html>");
2022-05-24 18:25:41 +02:00
lblCommentaire.setFont(new Font("Tahoma", Font.PLAIN, 14));
lblCommentaire.setHorizontalAlignment(SwingConstants.LEFT);
lblCommentaire.setVerticalAlignment(SwingConstants.TOP);
lblCommentaire.setBounds(20, 199, 472, 72);
2022-05-24 18:25:41 +02:00
getContentPane().add(lblCommentaire);
JLabel lblLicence = new JLabel("<HTML><B><U>Licence : GNU GLP 3.0</U></B> </HTML>");
lblLicence.setFont(new Font("Tahoma", Font.PLAIN, 14));
2022-12-08 21:35:00 +01:00
lblLicence.setBounds(305, 261, 187, 35);
2022-05-24 18:25:41 +02:00
getContentPane().add(lblLicence);
2022-12-08 21:35:00 +01:00
JButton btnNewButton = new JButton("<html><p {text-align: center;}>Vérifier s'il y a <br>une nouvelle version</p><html>");
if(commandes.newVersion) {
btnNewButton.setText("<html><p {text-align: center;}>Nouvelle version<br>"+commandes.nameNewVersion +"</p><html>");
}
2022-12-08 21:35:00 +01:00
btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 14));
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String url = "https://forge.chapril.org/pablo/analyseWriter/releases";
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
}
catch (java.io.IOException e1) {
System.out.println(e1.getMessage());
}
}
});
2022-12-08 21:35:00 +01:00
btnNewButton.setBounds(270, 100, 222, 72);
getContentPane().add(btnNewButton);
2022-12-08 21:35:00 +01:00
JLabel lblGPL3 = new JLabel("");
lblGPL3.setHorizontalAlignment(SwingConstants.CENTER);
lblGPL3.setIcon(new ImageIcon(about.class.getResource("/resources/GPLv3.png")));
lblGPL3.setBounds(315, 283, 139, 70);
getContentPane().add(lblGPL3);
JLabel lblNewVersion = new JLabel("");
lblNewVersion.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewVersion.setForeground(new Color(255, 0, 0));
if(commandes.newVersion) {
lblNewVersion.setText("Nouvelle version : " + commandes.nameNewVersion);
}
lblNewVersion.setBounds(20, 151, 240, 37);
getContentPane().add(lblNewVersion);
2022-05-24 18:25:41 +02:00
}
2022-06-19 21:01:30 +02:00
public static about getInstance() {
if (instance == null) {
instance = new about();
}
instance.setVisible(true);
return instance;
}
2022-05-24 18:25:41 +02:00
}