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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.sql.*;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException.*;
class FenText extends JFrame implements ActionListener
{
private double prixx;
private JButton brocoli,carotte,chouxfleur,courgette,haricot,poivron,pomme,orange,banane,kiwi,peche,fraise,balance;
private JLabel affichage;
private JPanel pano;
private JPanel container = new JPanel();
private JTextField poids;
private JTextField prix;
public FenText()
{
JFrame f= new JFrame();
f.setSize(1100, 620);
f.setTitle("Legumes&Freuits");
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
pano = new JPanel(new GridLayout(4,22));
affichage = new JLabel();
pano.add(brocoli);
pano.add(carotte);
pano.add(chouxfleur);
pano.add(courgette);
pano.add(haricot);
pano.add(poivron);
pano.add(pomme);
pano.add(orange);
pano.add(banane);
pano.add(kiwi);
pano.add(peche);
pano.add(fraise);
pano.add(balance);
add(pano);
setVisible(true);
JPanel top = new JPanel();
Font police = new Font("Arial", Font.BOLD,14);
poids.setFont(police);
poids.setPreferredSize(new Dimension(180,50));
top.add(new JLabel("POIDS (g)"));
top.add(poids);
prix.setFont(police);
prix.setPreferredSize(new Dimension(180,50));
top.add(new JLabel ("PRIX ()"));
top.add(prix);
//Container container = null;
container.add(top, BorderLayout.CENTER);
this.setContentPane(container);
this.setVisible(true);
ImageIcon BrocoliImage = new ImageIcon("/home/chebbah/brocoli.jpg");
ImageIcon CarotteImage = new ImageIcon("/home/chebbah/carotte.jpg");
ImageIcon ChouxFleurImage = new ImageIcon("/home/chebbah/chouxfleur.jpg");
ImageIcon CourgetteImage = new ImageIcon("/home/chebbah/courgette.jpg");
ImageIcon HaricotImage = new ImageIcon("/home/chebbah/haricot.jpg");
ImageIcon PoivronImage = new ImageIcon("/home/chebbah/poivrons.jpg");
ImageIcon PommeImage = new ImageIcon("/home/chebbah/pomme.jpg");
ImageIcon OrangeliImage = new ImageIcon("/home/chebbah/orange.jpg");
ImageIcon BananeImage = new ImageIcon("/home/chebbah/banane.jpg");
ImageIcon KiwiImage = new ImageIcon("/home/chebbah/kiwi.jpg");
ImageIcon PecheImage = new ImageIcon("/home/chebbah/peche.jpg");
ImageIcon FraiseImage = new ImageIcon("/home/chebbah/fraise.jpg");
ImageIcon BalanceImage = new ImageIcon("/home/chebbah/balance.jpg");
brocoli =new JButton("<html>BROCOLI<br><br><br><br><br><br><br> 1.98/Kg</html>", BrocoliImage);
carotte =new JButton("<html>CAROTTE<br><br><br><br><br><br><br> 1.98/Kg</html>", CarotteImage);
chouxfleur =new JButton("<html>CHOUXFLEUR<br><br><br><br><br><br><br> 1.98/Kg</html>", ChouxFleurImage);
courgette =new JButton("<html>COURGETTE<br><br><br><br><br><br><br> 1.98/Kg</html>", CourgetteImage);
haricot =new JButton("<html>HARICOT<br><br><br><br><br><br><br> 1.98/Kg</html>", PoivronImage);
poivron =new JButton("<html>POIVRON<br><br><br><br><br><br><br> 1.98/Kg</html>", HaricotImage);
pomme =new JButton("<html>POMME<br><br><br><br><br><br> 1.98/Kg</html>", PommeImage);
orange =new JButton("<html>ORANGE<br><br><br><br><br><br><br> 1.98/Kg</html>", OrangeliImage);
banane =new JButton("<html>BANANE<br><br><br><br><br><br><br> 1.98/Kg</html>", BananeImage);
kiwi =new JButton("<html>KIWI<br><br><br><br><br><br><br> 1.98/Kg</html>", KiwiImage);
peche =new JButton("<html>PECHE<br><br><br><br><br><br><br> 1.98/Kg</html>", PecheImage);
fraise =new JButton("<html>FRAISE<br><br><br><br><br><br><br> 1.98/Kg</html>", FraiseImage);
balance =new JButton("<html>CLIQUEZ ICI </html>",BalanceImage);
brocoli.addActionListener(this);
carotte.addActionListener (this);
chouxfleur.addActionListener(this);
courgette.addActionListener (this);
haricot.addActionListener(this);
poivron.addActionListener (this);
pomme.addActionListener(this);
orange.addActionListener (this);
banane.addActionListener(this);
kiwi.addActionListener(this);
peche.addActionListener (this);
fraise.addActionListener(this);
balance.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
public class FenetreLegum
{
public static void main (String args[])
{
FenText fen = new FenText();
fen.pack();
fen.setVisible(true);
}
} |
Partager