-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afaf384
commit d9425b0
Showing
5 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package ExercicesTP.IHM; | ||
|
||
import ExercicesTP.CRUD.EtudiantDAO; | ||
import ExercicesTP.Helpers.TableModelEtudiant; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
public class IHMAfficheEtudiant extends JInternalFrame { | ||
EtudiantDAO dao; | ||
JScrollPane jsp; | ||
public TableModelEtudiant model; | ||
JTable jt_Formation; | ||
JButton exitButton; | ||
JButton refreshButton; | ||
|
||
public IHMAfficheEtudiant(EtudiantDAO dao){ | ||
this.dao = dao; | ||
setTitle("Affichage des étudiants"); | ||
setSize(400, 400); | ||
initializeComponents(); | ||
createLayout(); | ||
addEventListeners(); | ||
setVisible(true); | ||
} | ||
void initializeComponents(){ | ||
jt_Formation = new JTable(); | ||
jsp = new JScrollPane(jt_Formation); | ||
String rq = "SELECT * FROM Etudiant;"; | ||
model = new TableModelEtudiant(dao.selection(rq), this.dao); | ||
jt_Formation.setModel(model); | ||
refreshButton = new JButton("Rafrachir"); | ||
exitButton = new JButton("Exit"); | ||
|
||
} | ||
void createLayout(){ | ||
|
||
this.add(jsp, BorderLayout.CENTER); | ||
JPanel pane = new JPanel(); | ||
pane.add(refreshButton); | ||
pane.add(exitButton); | ||
this.add(pane,BorderLayout.SOUTH); | ||
|
||
} | ||
void addEventListeners(){ | ||
refreshButton.addActionListener(e->{ | ||
String rq = "SELECT * FROM ETUDIANT"; | ||
model.updateTableWithNewResultSet(dao.selection(rq)); | ||
JOptionPane.showMessageDialog(this, "Refresh avec success"); | ||
}); | ||
exitButton.addActionListener(e->{ | ||
dispose(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters