1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Rectangle;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.io.File;
import java.awt.Button;
public class Fenêtre extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
/**
* This is the default constructor
*/
public Fenêtre() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(600, 436);
this.setContentPane(getJContentPane());
this.setTitle("ANYQCM - Analyseur de Questionnaires à choix multiples");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton2(), null);
}
return jContentPane;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton("Ouvrir un QCM");
jButton.setBounds(new Rectangle(31, 64, 139, 36));
jButton.setText("Ouvrir un QCM");
jButton.setActionCommand("Ouvrir un QCM");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser chooser = new JFileChooser();//création dun nouveau filechosser
chooser.setApproveButtonText("Choix du fichier..."); //intitulé du bouton
//chooser.showOpenDialog(null); //affiche la boite de dialogue
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
{
System.out.println(chooser.getSelectedFile().getAbsolutePath());
//status.setText(chooser.getSelectedFile().getAbsolutePath());
}
}
});
}
return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton("Ouvrir un QCM");
jButton1.setBounds(new Rectangle(34, 146, 134, 33));
jButton1.setText("Etalonner");
jButton1.setActionCommand("Ouvrir un QCM");
}
return jButton1;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton("Ouvrir un QCM");
jButton2.setBounds(new Rectangle(35, 241, 130, 36));
jButton2.setText("Executer");
jButton2.setActionCommand("Ouvrir un QCM");
}
return jButton2;
}
} // @jve:decl-index=0:visual-constraint="10,10" |
Partager