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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| package programme;
import java.awt.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.JButton;
import javax.swing.event.*;
import java.awt.event.ActionListener;
import java.awt.image.ColorModel;
public class EOQ extends JFrame {
private JPanel container = new JPanel();
/////////////////////////////////////////////////////////////
private JFormattedTextField K = new JFormattedTextField();
private JFormattedTextField Y = new JFormattedTextField();
private JFormattedTextField h = new JFormattedTextField();
////////////////////////////////////////////////////////////
private JLabel label = new JLabel("Le coût fixe de la commande (K)");
private JLabel label1 = new JLabel("Le nombre d'article (Y) ");
private JLabel label2 = new JLabel("Le coût de stockage (h) ");
private JLabel label3 = new JLabel(" La quantité optimale (Q*) ");
///////////////////////////////////////////////////////
private JButton Calculer = new JButton ("Calculer");
private JButton Supprimer = new JButton ("Supprimer");
public EOQ(){
this.setTitle("La quantité optimale de la commande");
this.setSize(400, 400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
JPanel top = new JPanel();
top.setBackground(Color.white);
Font police = new Font("Arial", Font.BOLD, 14);
K.setFont(police);
Y.setFont(police);
h.setFont(police);
////////////
K.setPreferredSize(new Dimension(150, 30));
Y.setPreferredSize(new Dimension(150, 30));
h.setPreferredSize(new Dimension(150, 30));
///////////////
K.setForeground(Color.BLUE);
Y.setForeground(Color.BLUE);
h.setForeground(Color.BLUE);
Calculer.addActionListener(new BoutonListener());
Supprimer.addActionListener(new BoutonListener());
JPanel panEcran = new JPanel();
panEcran.setPreferredSize(new Dimension(300, 40));
panEcran.setForeground(Color.RED);
panEcran.setBackground(Color.GRAY);
///////////////////////
top.add(label);
top.add(K);
top.add(label1);
top.add(Y);
top.add(label2);
top.add(h);
top.add(Calculer);
top.add(Supprimer);
top.add(label3);
top.add(panEcran);
top.setLayout(new FlowLayout(1,5,20));
this.setContentPane(top);
this.setVisible(true);
top.setLayout(new BorderLayout(400,400));
}
public static void main (String[] args)
{
EOQ a = new EOQ();
a.setVisible(true);
}
class BoutonListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource()==Calculer){
}
if(e.getSource()==Supprimer){
K.setText("");
Y.setText("");
h.setText("");
}
}
}
} |
Partager