modif main
This commit is contained in:
@@ -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<JButton> 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user