package fenetres; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; 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{ /** * */ private static final long serialVersionUID = 1L; private JFrame frmEvalwriter; JButton btnCreate; JButton actCharge; /** * Launch the application. */ public static void main(String[] args) { commandes.console=false; try { mainApp window = new mainApp(); System.out.println(commandes.os); 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); int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth(); int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight(); frmEvalwriter.setLocation(( (screenWidth) - frmEvalwriter.getWidth()) / 2, (screenHeight - frmEvalwriter.getHeight()) / 2); 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("Créer ou 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("Verif. version"); btnNewButton.setHorizontalAlignment(SwingConstants.LEFT); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { about.getInstance(); } }); 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 btnTutoriels = new JButton("Documentations"); btnTutoriels.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { String url = "https://sites.google.com/view/analyseWriter"; java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); } catch (java.io.IOException e1) { System.out.println(e1.getMessage()); } System.out.println( "Affiche les tutoriels." ); } }); btnTutoriels.setIcon(new ImageIcon(mainApp.class.getResource("/resources/documentation.png"))); btnTutoriels.setHorizontalAlignment(SwingConstants.LEFT); btnTutoriels.setFont(new Font("Arial", Font.PLAIN, 14)); btnTutoriels.setBounds(254, 270, 200, 60); frmEvalwriter.getContentPane().add(btnTutoriels); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==btnCreate) { create.getInstance(); frmEvalwriter.dispose(); } if(e.getSource()==actCharge) { if(!commandes.console) System.out.println( "Début chargement du fichier d'analyse." ); new evaluate(); frmEvalwriter.dispose(); } } }