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
|
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.event.ActionListener ;
public class FenetreAjout extends JFrame implements ActionListener{
....
//Déclaration des JComboBox
private JComboBox anneeCombo = new JComboBox();
private JComboBox genreCombo = new JComboBox();
private JComboBox realisateurCombo = new JComboBox();
private JComboBox acteurCombo = new JComboBox();
private JComboBox origineCombo = new JComboBox();
....
//*************************************************************************
//Connexion à la base de données
//*************************************************************************
Connection con= Connexion.getConnection();
String req1 = "SELECT LIBELLE_GENRE FROM ROYALDIVX.GENRES ORDER BY LIBELLE_GENRE";
Statement stmt;
try {
stmt = con.createStatement();
ResultatSet res = stmt.executeQuery(req1);
while (res.next()){
genreCombo.addItem(res.getString("GENRE")) ;
}
res.close();
}
catch (SQLException e){
e.printStackTrace();
}
//****************************************
//**************************************************************************
public FenetreAjout(){
super();
build3();
annulerBouton.addActionListener(this);
this.setVisible(true);
}
//**************************************************************************
//*************************************************************************
private void build3(){
setTitle("Royal Div'x : Ajouter un film");
setSize(600,500);
setLocationRelativeTo(null);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//On définit le Grid
monPanel.setLayout(new GridBagLayout());
....
} |
Partager