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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
| package dialogue;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import java.awt.Toolkit;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.NumberFormat;
import controle.modele.ModeleArticle;
import controle.modele.RendererDate;
import controle.modele.RendererGras;
import controle.utilitaires.GestionDates;
import javax.swing.JTextField;
import javax.swing.JFormattedTextField;
import java.text.Format;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JCheckBox;
import entite.Article;
import entite.Utilisateur;
public class FenArticles extends JFrame {
private JPanel contentPane;
private JLabel jLab_Fond;
private JLabel jLab_TitreClient;
private JLabel jLab_SousTitre;
private JLabel jLab_FondModule;
private JLabel jLab_Code;
private JTextField jTxT_Code;
private JLabel jLab_Designation;
private JTextField jTxT_Designation;
private JLabel Categorie;
private JTextField jTxT_Catergorie;
private JLabel jLab_Quantite;
private JLabel jLabel_PU;
private JLabel jLab_Trier;
private JFormattedTextField jTxt_Quantité;
private JFormattedTextField jTxt_PU;
private JLabel jLab_Recherche;
private JScrollPane JScrollPane;
private JTable table;
private JButton btn_Ajouter;
private JButton btn_Effacer;
private JButton btn_Modifier;
private JButton btn_Annuler;
private JLabel jLab_Ajouter;
private JLabel jLab_Rechercher;
private JLabel jLab_Modifier;
private JLabel jLab_Supprimer;
private JLabel jLab_Apercu;
private JLabel jLab_Imprimer;
private JLabel jLab_Exporter;
private JLabel jLab_Retour;
private JComboBox JComboBox_Tri;
private JTextField rechercher;
private JCheckBox jCheckBox_Taxable;
private int num_ligne_modify = 0;
private ModeleArticle leModeleArticle = new ModeleArticle();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
FenArticles frame = new FenArticles();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/*
* Methode permettant de basculer les boutons lors d'un ajout ou d'une modification
*/
private void bouton_mode_ajout_ou_edition(boolean isAjout){
if(isAjout){
btn_Ajouter.setEnabled(true);
btn_Effacer.setEnabled(true);
btn_Modifier.setEnabled(false);
btn_Annuler.setEnabled(false);
}else{
btn_Ajouter.setEnabled(false);
btn_Effacer.setEnabled(false);
btn_Modifier.setEnabled(true);
btn_Annuler.setEnabled(true);
}
}
/**
* Create the frame.
*/
public FenArticles() {
super();
setIconImage(Toolkit.getDefaultToolkit().getImage(FenArticles.class.getResource("/images/logoEclipse.png")));
setResizable(false);
setSize(1027,582);
setTitle("SWECOM ARTICLES");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
//setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
contentPane.add(getJCheckBox_Taxable());
contentPane.add(getRechercher());
contentPane.add(getJComboBox_Tri());
contentPane.add(getJLab_Retour());
contentPane.add(getJLab_Exporter());
contentPane.add(getJLab_Imprimer());
contentPane.add(getJLab_Apercu());
contentPane.add(getJLab_Supprimer());
contentPane.add(getJLab_Modifier());
contentPane.add(getJLab_Rechercher());
contentPane.add(getJLab_Ajouter());
contentPane.add(getBtn_Annuler());
contentPane.add(getBtn_Modifier());
contentPane.add(getBtn_Effacer());
contentPane.add(getBtn_Ajouter());
contentPane.add(getJScrollPane());
contentPane.add(getJLab_Recherche());
contentPane.add(getJTxt_PU());
contentPane.add(getJTxt_Quantité());
contentPane.add(getJLab_Trier());
contentPane.add(getJLabel_PU());
contentPane.add(getJLab_Quantite());
contentPane.add(getJTxT_Catergorie());
contentPane.add(getCategorie());
contentPane.add(getJTxT_Designation());
contentPane.add(getJLab_Designation());
contentPane.add(getJTxT_Code());
contentPane.add(getJLab_Code());
contentPane.add(getJLab_FondModule());
contentPane.add(getJLab_SousTitre());
contentPane.add(getJLab_TitreClient());
contentPane.add(getJLab_Fond());
table.getColumnModel().getColumn(0).setCellRenderer(new RendererGras());
table.getColumnModel().getColumn(1).setCellRenderer(new RendererGras());
table.getColumnModel().getColumn(4).setCellRenderer(new RendererGras());
}
private JLabel getJLab_Fond() {
if (jLab_Fond == null) {
jLab_Fond = new JLabel("");
jLab_Fond.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/fondGeneral.jpg")));
jLab_Fond.setBounds(0, 0, 1021, 591);
}
return jLab_Fond;
}
private JLabel getJLab_TitreClient() {
if (jLab_TitreClient == null) {
jLab_TitreClient = new JLabel("Gestion des articles");
jLab_TitreClient.setForeground(Color.DARK_GRAY);
jLab_TitreClient.setFont(new Font("Segoe UI", Font.PLAIN, 24));
jLab_TitreClient.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/Database.png")));
jLab_TitreClient.setBounds(312, 36, 290, 64);
}
return jLab_TitreClient;
}
private JLabel getJLab_SousTitre() {
if (jLab_SousTitre == null) {
jLab_SousTitre = new JLabel("Ajout, Modification, Suppression, Consultation et Impression");
jLab_SousTitre.setForeground(Color.DARK_GRAY);
jLab_SousTitre.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_SousTitre.setBounds(383, 81, 381, 14);
}
return jLab_SousTitre;
}
private JLabel getJLab_FondModule() {
if (jLab_FondModule == null) {
jLab_FondModule =
new JLabel("");
jLab_FondModule.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/fondModule1.png")));
jLab_FondModule.setBounds(261, 114, 741, 200);
}
return jLab_FondModule;
}
private JLabel getJLab_Code() {
if (jLab_Code == null) {
jLab_Code = new JLabel("Code");
jLab_Code.setForeground(Color.DARK_GRAY);
jLab_Code.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Code.setBounds(279, 139, 54, 21);
}
return jLab_Code;
}
private JTextField getJTxT_Code() {
if (jTxT_Code == null) {
jTxT_Code = new JTextField();
jTxT_Code.setForeground(new Color(26, 88, 131));
jTxT_Code.setFont(new Font("Segoe UI", Font.PLAIN, 14));
jTxT_Code.setColumns(10);
jTxT_Code.setBackground(Color.WHITE);
jTxT_Code.setBounds(364, 131, 218, 29);
}
return jTxT_Code;
}
private JLabel getJLab_Designation() {
if (jLab_Designation == null) {
jLab_Designation = new JLabel("Designation");
jLab_Designation.setForeground(Color.DARK_GRAY);
jLab_Designation.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Designation.setBounds(279, 178, 74, 21);
}
return jLab_Designation;
}
private JTextField getJTxT_Designation() {
if (jTxT_Designation == null) {
jTxT_Designation = new JTextField();
jTxT_Designation.setForeground(new Color(26, 88, 131));
jTxT_Designation.setFont(new Font("Segoe UI", Font.PLAIN, 14));
jTxT_Designation.setColumns(10);
jTxT_Designation.setBackground(Color.WHITE);
jTxT_Designation.setBounds(364, 170, 218, 29);
}
return jTxT_Designation;
}
private JLabel getCategorie() {
if (Categorie == null) {
Categorie = new JLabel("Cat\u00E9gorie");
Categorie.setForeground(Color.DARK_GRAY);
Categorie.setFont(new Font("Segoe UI", Font.BOLD, 12));
Categorie.setBounds(648, 139, 74, 21);
}
return Categorie;
}
private JTextField getJTxT_Catergorie() {
if (jTxT_Catergorie == null) {
jTxT_Catergorie = new JTextField();
jTxT_Catergorie.setForeground(new Color(26, 88, 131));
jTxT_Catergorie.setFont(new Font("Segoe UI", Font.PLAIN, 14));
jTxT_Catergorie.setColumns(10);
jTxT_Catergorie.setBackground(Color.WHITE);
jTxT_Catergorie.setBounds(732, 134, 218, 29);
}
return jTxT_Catergorie;
}
private JLabel getJLab_Quantite() {
if (jLab_Quantite == null) {
jLab_Quantite = new JLabel("Quantit\u00E9");
jLab_Quantite.setForeground(Color.DARK_GRAY);
jLab_Quantite.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Quantite.setBounds(279, 219, 74, 21);
}
return jLab_Quantite;
}
private JLabel getJLabel_PU() {
if (jLabel_PU == null) {
jLabel_PU = new JLabel("Prix unitaire");
jLabel_PU.setForeground(Color.DARK_GRAY);
jLabel_PU.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLabel_PU.setBounds(648, 183, 82, 21);
}
return jLabel_PU;
}
private JCheckBox getJCheckBox_Taxable() {
if (jCheckBox_Taxable == null) {
jCheckBox_Taxable = new JCheckBox("Taxable");
jCheckBox_Taxable.setFont(new Font("Segoe UI", Font.BOLD, 12));
jCheckBox_Taxable.setBounds(732, 220, 97, 23);
}
return jCheckBox_Taxable;
}
private JLabel getJLab_Trier() {
if (jLab_Trier == null) {
jLab_Trier = new JLabel("Trier la liste par");
jLab_Trier.setForeground(Color.DARK_GRAY);
jLab_Trier.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/trier.png")));
jLab_Trier.setFont(new Font("Segoe UI", Font.PLAIN, 12));
jLab_Trier.setBounds(289, 501, 139, 42);
}
return jLab_Trier;
}
private JFormattedTextField getJTxt_Quantité() {
if (jTxt_Quantité == null) {
jTxt_Quantité = new JFormattedTextField(NumberFormat.getNumberInstance());
jTxt_Quantité.setFont(new Font("Segoe UI", Font.PLAIN, 12));
jTxt_Quantité.setBounds(363, 216, 218, 29);
jTxt_Quantité.setForeground(new Color(26, 88, 131));
}
return jTxt_Quantité;
}
private JFormattedTextField getJTxt_PU() {
if (jTxt_PU == null) {
jTxt_PU = new JFormattedTextField((Format) null);
jTxt_PU.setForeground(new Color(26, 88, 131));
jTxt_PU.setFont(new Font("Segoe UI", Font.PLAIN, 12));
jTxt_PU.setBounds(732, 175, 218, 29);
jTxt_PU.setForeground(new Color(26, 88, 137));
}
return jTxt_PU;
}
private JLabel getJLab_Recherche() {
if (jLab_Recherche == null) {
jLab_Recherche = new JLabel("Rechercher");
jLab_Recherche.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/chercheAssiste.png")));
jLab_Recherche.setForeground(Color.DARK_GRAY);
jLab_Recherche.setFont(new Font("Segoe UI", Font.PLAIN, 12));
jLab_Recherche.setBounds(659, 502, 139, 42);
}
return jLab_Recherche;
}
private JScrollPane getJScrollPane() {
if (JScrollPane == null) {
JScrollPane = new JScrollPane();
JScrollPane.setBounds(261, 318, 741, 166);
JScrollPane.setViewportView(getTable());
}
return JScrollPane;
}
private JTable getTable() {
if (table == null) {
table = new JTable(leModeleArticle);
// bulle d'aide : utilisation de code html dans Java
table.setToolTipText("<html><img src=\""+
FenArticles.class.getResource("/images/gestion/retour.png")+
"\" />Pour <b>modifier</b> une ligne, vous devez <b>double-cliquez</b> sur <b>celle-ci</b></html>");
table.addMouseListener(new java.awt.event.MouseAdapter(){
public void mousePressed(java.awt.event.MouseEvent e){
if(e.getClickCount() == 2){
num_ligne_modify = table.getSelectedRow();
jTxT_Code.setText(String.valueOf(table.getValueAt(num_ligne_modify, 0)));
jTxT_Catergorie.setText(String.valueOf(table.getValueAt(num_ligne_modify, 1)));
jTxT_Designation.setText(String.valueOf(table.getValueAt(num_ligne_modify, 2)));
jTxt_Quantité.setText(String.valueOf(table.getValueAt(num_ligne_modify, 3)));
jTxt_PU.setText(String.valueOf(table.getValueAt(num_ligne_modify, 4)));
bouton_mode_ajout_ou_edition(false);
}
}
});
}
return table;
}
private JButton getBtn_Ajouter() {
if (btn_Ajouter == null) {
btn_Ajouter = new JButton("Ajouter");
btn_Ajouter.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
String vCode = jTxT_Code.getText();
if(!vCode.equals("")){
String vCategorie = jTxT_Catergorie.getText();
String vDesignation = jTxT_Designation.getText();
int vQuantite = Integer.valueOf(jTxt_Quantité.getText());
double vPrix_Unitaire = Double.valueOf(jTxt_PU.getText());
boolean bTaxable = jCheckBox_Taxable.isSelected();
Date vDate = GestionDates.dateJavaEnDateSQL(new Date());
String strDateMySQL = GestionDates.dateEnChaineFR(vDate);
//Variable int à partir du booléen
int iTaxable;
if(bTaxable == true){
iTaxable = 1;
}else{
iTaxable = 0;
}
Article unArticle = new Article(vCode, Utilisateur.Utilisateur_connecte.getCode_utilisateur(), vCategorie, vDesignation,
vDate, bTaxable, vPrix_Unitaire, vQuantite);
boolean bCreation = false ;
bCreation = unArticle.creerCRUD(vCode, Utilisateur.Utilisateur_connecte.getCode_utilisateur(), vCategorie, vDesignation, strDateMySQL, iTaxable, vPrix_Unitaire, vQuantite);
if(bCreation){
leModeleArticle.creerMOD(unArticle);
jTxT_Code.setText("");
jTxT_Catergorie.setText("");
jTxT_Designation.setText("");
jTxt_PU.setText("");
jTxt_Quantité.setText("");
jCheckBox_Taxable.setSelected(false);
jTxT_Code.requestFocus();
}
}else{
JOptionPane.showMessageDialog(null, "Le code article est obligatoire", "Avertissement", JOptionPane.WARNING_MESSAGE);
}
}
});
btn_Ajouter.setFont(new Font("Segoe UI", Font.PLAIN, 12));
btn_Ajouter.setBounds(498, 269, 104, 38);
}
return btn_Ajouter;
}
private JButton getBtn_Effacer() {
if (btn_Effacer == null) {
btn_Effacer = new JButton("Effacer");
btn_Effacer.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
jTxT_Code.setText("");
jTxT_Catergorie.setText("");
jTxT_Designation.setText("");
jTxt_PU.setText("");
jTxt_Quantité.setText("");
jCheckBox_Taxable.setEnabled(true);
}
});
btn_Effacer.setFont(new Font("Segoe UI", Font.PLAIN, 12));
btn_Effacer.setBounds(612, 269, 104, 38);
}
return btn_Effacer;
}
private JButton getBtn_Modifier() {
if (btn_Modifier == null) {
btn_Modifier = new JButton("Modifier");
btn_Modifier.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
String vCode = jTxT_Code.getText();
if(!vCode.equals("")){
String vCategorie = jTxT_Catergorie.getText();
String vDesignation = jTxT_Designation.getText();
int vQuantite = Integer.valueOf(jTxt_Quantité.getText());
double vPrix_Unitaire = Double.valueOf(jTxt_PU.getText());
boolean bTaxable = jCheckBox_Taxable.isSelected();
Date vDate = GestionDates.dateJavaEnDateSQL(new Date());
String strDateMySQL = GestionDates.dateEnChaineFR(vDate);
//Variable int à partir du booléen
int iTaxable;
if(bTaxable == true){
iTaxable = 1;
}else{
iTaxable = 0;
}
Article unArticle = new Article(vCode, Utilisateur.Utilisateur_connecte.getCode_utilisateur(), vCategorie, vDesignation,
vDate, bTaxable, vPrix_Unitaire, vQuantite);
boolean bCreation = false ;
bCreation = unArticle.creerCRUD(vCode, Utilisateur.Utilisateur_connecte.getCode_utilisateur(), vCategorie, vDesignation, strDateMySQL, iTaxable, vPrix_Unitaire, vQuantite);
if(bCreation){
leModeleArticle.setValueAt(vCode, num_ligne_modify, 0);
leModeleArticle.setValueAt(vCategorie, num_ligne_modify, 1);
leModeleArticle.setValueAt(vDesignation, num_ligne_modify, 2);
leModeleArticle.setValueAt(vQuantite, num_ligne_modify, 3);
leModeleArticle.setValueAt(vPrix_Unitaire, num_ligne_modify, 4);
leModeleArticle.modifierMOD(num_ligne_modify, num_ligne_modify, unArticle);
jTxT_Code.setText("");
jTxT_Catergorie.setText("");
jTxT_Designation.setText("");
jTxt_PU.setText("");
jTxt_Quantité.setText("");
jCheckBox_Taxable.setSelected(true);
jTxT_Code.requestFocus();
bouton_mode_ajout_ou_edition(true);
}
}else{
JOptionPane.showMessageDialog(null, "Le code article est obligatoire", "Avertissement", JOptionPane.WARNING_MESSAGE);
}
}
});
btn_Modifier.setFont(new Font("Segoe UI", Font.PLAIN, 12));
btn_Modifier.setBounds(732, 269, 104, 38);
}
return btn_Modifier;
}
private JButton getBtn_Annuler() {
if (btn_Annuler == null) {
btn_Annuler = new JButton("Annuler");
btn_Annuler.setFont(new Font("Segoe UI", Font.PLAIN, 12));
btn_Annuler.setBounds(846, 269, 104, 38);
}
return btn_Annuler;
}
private JLabel getJLab_Ajouter() {
if (jLab_Ajouter == null) {
jLab_Ajouter = new JLabel("Ajouter");
jLab_Ajouter.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/ajouter.png")));
jLab_Ajouter.setForeground(Color.WHITE);
jLab_Ajouter.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Ajouter.setBounds(10, 11, 130, 48);
}
return jLab_Ajouter;
}
private JLabel getJLab_Rechercher() {
if (jLab_Rechercher == null) {
jLab_Rechercher = new JLabel("Rechercher");
jLab_Rechercher.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/chercher.png")));
jLab_Rechercher.setForeground(Color.WHITE);
jLab_Rechercher.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Rechercher.setBounds(10, 64, 159, 48);
}
return jLab_Rechercher;
}
private JLabel getJLab_Modifier() {
if (jLab_Modifier == null) {
jLab_Modifier = new JLabel("Modifier");
jLab_Modifier.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/modifier.png")));
jLab_Modifier.setForeground(Color.WHITE);
jLab_Modifier.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Modifier.setBounds(10, 123, 130, 48);
}
return jLab_Modifier;
}
private JLabel getJLab_Supprimer() {
if (jLab_Supprimer == null) {
jLab_Supprimer = new JLabel("Supprimer");
jLab_Supprimer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jLab_Supprimer.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent arg0){
int numLigne = table.getSelectedRow();
if(numLigne == -1){
JOptionPane.showMessageDialog(null, "Vous devez sélectionner une ligne pour la supprimer", "Avertissement", JOptionPane.WARNING_MESSAGE);
}else{
int choix = JOptionPane.showConfirmDialog(null, "Voulez-vous vraiment supprimer l'article sélectionné ?", "Confirmation", JOptionPane.YES_NO_OPTION);
if(choix == 0){
String vCode = table.getValueAt(numLigne, 0).toString();
Article unArticle = new Article(vCode);
unArticle.supprimerCRUD(vCode);
leModeleArticle.supprimerMOD(numLigne);
}
}
}
public void mouseEntered(MouseEvent arg0) {
jLab_Supprimer.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/supprimer2.png")));
jLab_Supprimer.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
}
public void mouseExited(MouseEvent arg0) {
jLab_Supprimer.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/supprimer3.png")));
jLab_Supprimer.setBorder(null);
}
});
jLab_Supprimer.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/supprimer3.png")));
jLab_Supprimer.setForeground(Color.WHITE);
jLab_Supprimer.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Supprimer.setBounds(10, 175, 149, 48);
}
return jLab_Supprimer;
}
private JLabel getJLab_Apercu() {
if (jLab_Apercu == null) {
jLab_Apercu = new JLabel(" Aper\u00E7u avant impression");
jLab_Apercu.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/apercu4.png")));
jLab_Apercu.setForeground(Color.WHITE);
jLab_Apercu.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Apercu.setBounds(10, 269, 218, 48);
}
return jLab_Apercu;
}
private JLabel getJLab_Imprimer() {
if (jLab_Imprimer == null) {
jLab_Imprimer = new JLabel("Imprimer");
jLab_Imprimer.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/imprimer4.png")));
jLab_Imprimer.setForeground(Color.WHITE);
jLab_Imprimer.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Imprimer.setBounds(10, 328, 218, 48);
}
return jLab_Imprimer;
}
private JLabel getJLab_Exporter() {
if (jLab_Exporter == null) {
jLab_Exporter = new JLabel("Exporter");
jLab_Exporter.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/export4.png")));
jLab_Exporter.setForeground(Color.WHITE);
jLab_Exporter.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Exporter.setBounds(10, 387, 218, 48);
}
return jLab_Exporter;
}
private JLabel getJLab_Retour() {
if (jLab_Retour == null) {
jLab_Retour = new JLabel("Retour au menu principal");
jLab_Retour.setIcon(new ImageIcon(FenArticles.class.getResource("/images/gestion/retour.png")));
jLab_Retour.setForeground(Color.WHITE);
jLab_Retour.setFont(new Font("Segoe UI", Font.BOLD, 12));
jLab_Retour.setBounds(10, 488, 218, 48);
jLab_Retour.setCursor(new Cursor(Cursor.HAND_CURSOR));
jLab_Retour.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent arg0){
setVisible(false);
System.gc();
}
});
}
return jLab_Retour;
}
private JComboBox<String> getJComboBox_Tri() {
if (JComboBox_Tri == null) {
JComboBox_Tri = new JComboBox<String>();
JComboBox_Tri.setForeground(Color.DARK_GRAY);
JComboBox_Tri.setFont(new Font("Segoe UI", Font.PLAIN, 12));
JComboBox_Tri.setBounds(438, 513, 120, 20);
JComboBox_Tri.addItem("Code");
JComboBox_Tri.addItem("Catégorie");
JComboBox_Tri.addItem("Désignation");
JComboBox_Tri.addItem("Quantité");
JComboBox_Tri.addItem("Prix unitaire");
}
return JComboBox_Tri;
}
private JTextField getRechercher() {
if (rechercher == null) {
rechercher = new JTextField();
rechercher.setForeground(Color.DARK_GRAY);
rechercher.setForeground(new Color(26, 88, 131));
rechercher.setBackground(Color.WHITE);
rechercher.setFont(new Font("Segoe UI", Font.PLAIN, 12));
rechercher.setBounds(780, 514, 218, 29);
rechercher.setColumns(10);
}
return rechercher;
}
} |
Partager