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
|
public Fenetre() throws ParseException {
setSize(710, 350); // POUR DIMENSIONNER LA FENETRE
contenu.setLayout(new GridBagLayout());
c = new GridBagConstraints();
//:::::::::::::::::::::::::LIGNE0::::::::::::::::::::::::::::::
lfichier1 = new JLabel(" Fichier IAT: ");//LABEL fichier 1
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.NONE;
c.gridx = 0;
c.gridy = 0;
c.insets = new Insets(0, 0, 0, 0);
contenu.add(lfichier1, c);
fichier1 = new JTextField();
fichier1.setColumns(tailleJTextField);
fichier1.setEditable(false);
fichier1.setBackground(Color.cyan);
c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
c.weightx=0.5;
c.gridx = 1;
c.gridy = 0;
//c.insets = new Insets(5, 5, 5, 5);
contenu.add(fichier1, c);
parcourir1 = new JButton("Parcourir", createImageIcon("parcourir.png")); //Bouton Parcourir fichier 1
// Ecouteur pour le bouton qui permet de parcourir et trouver le fichier journal des envois
parcourir1.addActionListener(this);
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.NONE;
// c.gridwidth = 1;
c.gridx = 2;
c.gridy = 0;
c.insets = new Insets(5, 5, 5, 10);
contenu.add(parcourir1, c);
//parcourir2.setEnabled(false);
send1 = new JButton("Contrôle", createImageIcon("controler.png"));
send1.addActionListener(this);
c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.NONE;
c.insets = new Insets(10, 5, 5, 0);
//c.gridwidth = 2;
c.gridx = 3;
c.gridy = 0;
contenu.add(send1, c);
send1.setToolTipText("Appuyer pour controler le fichier IAT");
//send1.setEnabled(false);
// Create a file chooser for the button send
fc = new JFileChooser();
//fc.addPropertyChangeListener(this);
// Creation d'un JPopupMenu
labelPopupMenu = new JPopupMenu();
labelPopupMenu.add(new JMenuItem("Transferer",createImageIcon("page_go.png")));
//:::::::::::::::::::::::::LIGNE1:::::::::::::::::::::::::::::
labErreur = new JLabel("Erreurs trouvées: ");
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.NONE;
c.insets = new Insets(10, 5, 5, 0);
// c.gridwidth = 3;
c.gridx = 0;
c.gridy = 1;
contenu.add(labErreur, c);
//:::::::::::::::::::::::::LIGNE2:::::::::::::::::::::::::::::
//JTable
tm = new DefaultTableModel();
tm.addColumn("N°PORTABLE FAUX");
tm.addColumn("EMAIL FAUX");
tm.addColumn("Message d'erreur");
tm.addColumn("AGENT");
tm.addColumn("ID_BP_SYMPH");
table = new JTable(tm);
Dimension size = new Dimension(450, 160);
table.setPreferredScrollableViewportSize(size);
scrollpane = new JScrollPane(table);
DefaultTableCellRenderer custom = new DefaultTableCellRenderer();
custom.setHorizontalAlignment(JLabel.CENTER);
table.getColumnModel().getColumn(0).setCellRenderer(custom);
table.getColumnModel().getColumn(0).setMaxWidth(150);
// table.getColumnModel().getColumn(2).setMinWidth(175);
// table.getColumnModel().getColumn(2).setCellRenderer(custom);
table.getColumnModel().getColumn(4).setMaxWidth(150);
//active le tri du tableau
table.setAutoCreateRowSorter(true);
SortKey[] sks = new SortKey[]{ new RowSorter.SortKey(0, SortOrder.ASCENDING) };
//tri defaut tab sur 1ère colonne ds l'ordre croissant
table.getRowSorter().setSortKeys(Arrays.asList(sks));
//c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.HORIZONTAL;
c.ipady = 80; //make this component tall
c.gridwidth = 3;
c.gridx = 0;
c.gridy = 2;
contenu.add(scrollpane, c);
this.pack();
} |
Partager