From 1787a07845e1d2399e694a46f1ae50208b7e63e6 Mon Sep 17 00:00:00 2001 From: saaya-code Date: Wed, 27 Mar 2024 22:06:55 +0100 Subject: [PATCH] added disabling and enabling buttons recherEtudiant --- src/ExercicesTP/IHM/IHMRechercheEtudiant.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ExercicesTP/IHM/IHMRechercheEtudiant.java b/src/ExercicesTP/IHM/IHMRechercheEtudiant.java index 9ebad30..1874dab 100644 --- a/src/ExercicesTP/IHM/IHMRechercheEtudiant.java +++ b/src/ExercicesTP/IHM/IHMRechercheEtudiant.java @@ -64,6 +64,9 @@ private void initializeComponents() { model = new TableModelEtudiant(dao.selection(rq), dao); jt_Etudiant.setModel(model); sp = new JScrollPane(jt_Etudiant); + rechercheButton.setEnabled(false); + modifierButton.setEnabled(false); + supprimerButton.setEnabled(false); } @@ -186,6 +189,13 @@ private void addEventListeners() { JOptionPane.showMessageDialog(this, "Etudiant supprimé"); clearInputs(); }); + numEtdField.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + rechercheButton.setEnabled(!numEtdField.getText().isEmpty()); + supprimerButton.setEnabled(!numEtdField.getText().isEmpty()); + modifierButton.setEnabled(!numEtdField.getText().isEmpty()); + } + }); }