diff --git a/src/fr/iutfbleau/papillon/Crud.java b/src/fr/iutfbleau/papillon/Crud.java new file mode 100644 index 0000000..a79900a --- /dev/null +++ b/src/fr/iutfbleau/papillon/Crud.java @@ -0,0 +1,29 @@ +// package fr.iutfbleau.papillon; + +import java.util.ArrayList; +import java.util.List; +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +public class Crud extends ArrayList implements ActionListener{ + + private JButton btnAdd = new JButton("Ajouter"); + private JButton btnDel = new JButton("Supprimer"); + + public Crud(){ + btnAdd.addActionListener(this); + btnDel.addActionListener(this); + add(btnAdd); + add(btnDel); + } + + public void actionPerformed(ActionEvent e){ + if(e.getSource()==btnAdd){ + System.out.println("test ajouter"); + } + if(e.getSource()==btnDel){ + System.out.println("test supprimer"); + } + } +} \ No newline at end of file diff --git a/src/fr/iutfbleau/papillon/Main.java b/src/fr/iutfbleau/papillon/Main.java new file mode 100644 index 0000000..77e43d8 --- /dev/null +++ b/src/fr/iutfbleau/papillon/Main.java @@ -0,0 +1,43 @@ +// package fr.iutfbleau.papillon; + +import javax.swing.*; +import java.awt.*; + +public class Main extends JFrame { + + public Main(){ + super("Papillon"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setSize(400, 150); + + Crud crud = new Crud(); + + JPanel panel = new JPanel(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + + + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + c.weightx = 1.0; + c.insets = new Insets(4, 4, 4, 4); + + + + c.gridx = 0; + c.gridy = 0; + panel.add(crud.get(0), c); + + c.gridx = 0; + c.gridy = 1; + panel.add(crud.get(1), c); + + setContentPane(panel); + } + + + public static void main(String[] args) { + + Main f = new Main(); + f.setVisible(true); + } +} \ No newline at end of file diff --git a/src/fr/iutfbleau/papillon/VuePrincipale.java b/src/fr/iutfbleau/papillon/VuePrincipale.java deleted file mode 100644 index f8f218b..0000000 --- a/src/fr/iutfbleau/papillon/VuePrincipale.java +++ /dev/null @@ -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() { - } -} \ No newline at end of file