analyseWriter/src/app/mainApp.java

147 lines
4.6 KiB
Java

package app;
import java.awt.Desktop;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import MEPTL.commandes;
import java.awt.SystemColor;
public class mainApp extends JFrame implements ActionListener{
//public static final String LOOK_AND_FEEL_1 = "javax.swing.plaf.nimbus.NimbusLookAndFeel";
/**
*
*/
private static final long serialVersionUID = 1L;
private JFrame frmEvalwriter;
// public static JFrame Creer ;
JButton btnCreate;
JButton actCharge;
/**
* Launch the application.
*/
public static void main(String[] args) {
commandes.console=false;
// EventQueue.invokeLater(new Runnable() {
// public void run() {
try {
mainApp window = new mainApp();
// window.setVisible(true);
window.frmEvalwriter.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
// }
// });
}
/**
* Create the application.
*/
public mainApp() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmEvalwriter = new JFrame();
frmEvalwriter.setResizable(false);
frmEvalwriter.setTitle("analyseWriter");
frmEvalwriter.setBounds(100, 100, 500, 380);
frmEvalwriter.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frmEvalwriter.getContentPane().setLayout(null);
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
frmEvalwriter.setIconImage(img.getImage());
btnCreate = new JButton("Modifier un fichier d'analyse");
btnCreate.setHorizontalAlignment(SwingConstants.LEFT);
btnCreate.setIcon(new ImageIcon(mainApp.class.getResource("/resources/fichierAnalyseModif.png")));
btnCreate.setFont(new Font("Arial", Font.BOLD, 16));
btnCreate.addActionListener(this);
btnCreate.setBounds(34, 180, 420, 60);
frmEvalwriter.getContentPane().add(btnCreate);
actCharge = new JButton("Evaluer les fichiers des étudiants");
actCharge.setHorizontalAlignment(SwingConstants.LEFT);
actCharge.setIcon(new ImageIcon(mainApp.class.getResource("/resources/evaluate.png")));
actCharge.setBackground(SystemColor.inactiveCaption);
actCharge.addActionListener(this);
actCharge.setFont(new Font("Arial", Font.BOLD, 16));
actCharge.setBounds(34, 110, 420, 60);
frmEvalwriter.getContentPane().add(actCharge);
JLabel lblNewLabel = new JLabel();
ImageIcon img2 = new ImageIcon(getClass().getResource("/accueil.png") );
lblNewLabel.setIcon(img2);
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("Pacifico", Font.PLAIN, 26));
lblNewLabel.setBounds(10, 25, 470, 74);
frmEvalwriter.getContentPane().add(lblNewLabel);
JButton btnNewButton = new JButton("Informations");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new about();
}
});
btnNewButton.setFont(new Font("Arial", Font.PLAIN, 14));
btnNewButton.setIcon(new ImageIcon(mainApp.class.getResource("/resources/apropos.png")));
btnNewButton.setBounds(34, 270, 200, 60);
frmEvalwriter.getContentPane().add(btnNewButton);
JButton btnDocumentation = new JButton("Documentation");
btnDocumentation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Desktop d = Desktop.getDesktop();
try {
d.open(new File(evaluate.class.getResource("/resources/documentation.pdf").getPath()));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnDocumentation.setIcon(new ImageIcon(mainApp.class.getResource("/resources/documentation.png")));
btnDocumentation.setFont(new Font("Arial", Font.PLAIN, 14));
btnDocumentation.setBounds(254, 270, 200, 60);
frmEvalwriter.getContentPane().add(btnDocumentation);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==btnCreate) {
new create();
frmEvalwriter.dispose();
}
if(e.getSource()==actCharge) {
if(!commandes.console) System.out.println( "Début chargement du fichier d'analyse." );
evaluate f = new evaluate();
frmEvalwriter.dispose();
}
}
}