Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08ce0e73d8 |
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
-- Table principale : les rappels
|
||||
|
||||
CREATE TABLE rappel (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
titre VARCHAR(50) NOT NULL,
|
||||
contenu TEXT,
|
||||
theme VARCHAR(30),
|
||||
rang INT
|
||||
);
|
||||
@@ -1,16 +0,0 @@
|
||||
package fr.iutfbleau.papillon.vue;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class VuePrincipale extends JFrame {
|
||||
// composants publics “contrôlés” par le contrôleur
|
||||
public final JTextField champTitre = new JTextField(20);
|
||||
public final JTextArea champContenu = new JTextArea(4, 20);
|
||||
public final JTextArea zoneAffiche = new JTextArea(12, 26);
|
||||
public final JButton boutonAjouter = new JButton("Ajouter");
|
||||
public final JButton boutonLister = new JButton("Lister");
|
||||
|
||||
public VuePrincipale() {
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package fr.iutfbleau.papillon.model;
|
||||
import org.mariadb.jdbc.MariaDbDataSource;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class BaseDeDonnees {
|
||||
|
||||
private static Connection connexion;
|
||||
|
||||
public static Connection getConnexion() {
|
||||
if (connexion == null) {
|
||||
try {
|
||||
MariaDbDataSource dataSource = new MariaDbDataSource();
|
||||
dataSource.setUrl("jdbc:mariadb://localhost:3307/papillon");
|
||||
dataSource.setUser("root");
|
||||
dataSource.setPassword("mdp");
|
||||
|
||||
connexion = dataSource.getConnection();
|
||||
System.out.println(" Connexion réussie !");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return connexion;
|
||||
}
|
||||
|
||||
public static void fermer() {
|
||||
try {
|
||||
if (connexion != null && !connexion.isClosed()) {
|
||||
connexion.close();
|
||||
System.out.println(" Connexion fermée.");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package fr.iutfbleau.papillon.model;
|
||||
|
||||
public class Rappel {
|
||||
private int id;
|
||||
private String titre;
|
||||
private String contenu;
|
||||
private LocalDateTime date;
|
||||
|
||||
public Rappel(int id, String titre, String contenu, LocalDateTime date) {
|
||||
this.id = id;
|
||||
this.titre = titre;
|
||||
this.contenu = contenu;
|
||||
this.date = date;
|
||||
}
|
||||
public Rappel(String titre, String contenu, String theme, int rang){
|
||||
this(0,titre,contenu,theme,rang);
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
return id;
|
||||
}
|
||||
public String getTitre(){
|
||||
return titre;
|
||||
}
|
||||
public String getContenu(){
|
||||
return contenu;
|
||||
}
|
||||
public String getTheme(){
|
||||
return theme;
|
||||
}
|
||||
public int getRang(){
|
||||
return rang;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
/*package fr.iutfbleau.papillon.vue;*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class VuePrincipale extends JFrame {
|
||||
// composants publics “contrôlés” par le contrôleur
|
||||
public static JTextField champTitre = new JTextField(20);
|
||||
public static JTextArea champContenu = new JTextArea(4, 20);
|
||||
public static JTextArea zoneAffiche = new JTextArea(12, 26);
|
||||
public static JButton boutonAjouter = new JButton("Ajouter");
|
||||
public static JButton boutonLister = new JButton("Lister");
|
||||
|
||||
public VuePrincipale() {
|
||||
super("Rappel");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setSize(300, 300);
|
||||
setLayout(new GridLayout(5, 1));
|
||||
|
||||
add(champTitre);
|
||||
add(champContenu);
|
||||
add(zoneAffiche);
|
||||
add(boutonAjouter);
|
||||
add(boutonLister);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new VuePrincipale();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user