Java Cool Dude said:Doh the procedure is the same as creating a Frame or JFrame, you don't need to do any extra stuff
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent.*;
import javax.swing.*;
import java.lang.*;
import java.awt.image.*;
import java.awt.Toolkit;
public class loca extends Frame implements ActionListener, ItemListener {
private Panel p1, p2, p3;
private TextField codeabo;
private Choice ch, ch2, ch3;
private Button ok;
private Image image;
//private boolean chargementTermine = false;
private CheckboxGroup gr, gr2;
private Checkbox rad1, rad2, rad3, rad4, rad5, rad6, rad7;
private List montant;
private double total, total1, total2, total3, total4;
private float dev;
private int verif;
private String codeent;
private String codeconnu;
private TextField testcode;
public loca(String titre) { //le constructeur
//super (titre);
p1 = new Panel();
p1.setLayout (new GridLayout (10,2));
p1.add (new Label ("Classement par genre :"));
ch = new Choice();
ch.addItem("------");
ch.addItem("Action");
ch.addItem("Comédie");
ch.addItem("Policier");
ch.addItem("Fantastique");
ch.addItem("Dessin anime");
ch.select(0);
p1.add (ch);
p1.add (new Label ("Faites votre choix parmi la liste suivante :"));
ch2 = new Choice();
ch2.addItem("------");
ch2.select(0);
p1.add (ch2);
p1.add (new Label ("Duree de location :"));
p2 = new Panel();
p2.setLayout (new GridLayout (2,2));
gr = new CheckboxGroup();
rad1 = new Checkbox("6h", false, gr);
rad2 = new Checkbox("12h", false , gr);
rad3 = new Checkbox("24h", false , gr);
rad4 = new Checkbox("48h", false , gr);
p2.add (rad1);
p2.add (rad2);
p2.add (rad3);
p2.add (rad4);
p1.add(p2);
p1.add (new Label ("Paiement :"));
p3 = new Panel();
p3.setLayout (new GridLayout (3,1));
gr2 = new CheckboxGroup();
rad5 = new Checkbox("Carte abonne", false, gr2);
rad6 = new Checkbox("CB", true , gr2);
rad7 = new Checkbox("Cheque", false , gr2);
p3.add (rad5);
p3.add (rad6);
p3.add (rad7);
p1.add (p3);
p1.add (new Label ("Code abonne (si paiement par carte abonne) :"));
codeabo = new TextField(" ");
p1.add (codeabo);
p1.add (new Label ("Devise :"));
ch3 = new Choice();
ch3.addItem("Euros (€)");
ch3.addItem("Dollars ($)");
ch3.addItem("Livres (£)");
ch3.addItem("Francs Suisse (CHF)");
ch3.select(0);
p1.add (ch3);
p1.add (new Label ("Montant :"));
montant = new List(1);
p1.add (montant);
p1.add (new Label (""));
ok = new Button("Valider");
p1.add (ok);
testcode = new TextField ("Coucou");
p1.add(testcode);
//JPanel image = new JPanel();
//image.add(ch2);
//image1 = getToolkit().getImage("montebello.jpg");
//p1.add(image);
//public void paintComponent(Graphics g){
//super.paintComponent(g);
//g.drawImage(image1, 0, 0, getWidth(), getHeight(), this);
//}
add (p1);
codeconnu = "src4e05";
//codeent = codeabo.getText();
/*JPanel monjpanel = new JPanel(){
public void paint(Graphics g){
super.paint(g);
Image Background = getToolkit().getImage("bodega.jpg");
g.drawImage(Background, 40, 100, this);
repaint();
}
}*/
// ajout d'écouteurs d'item sur les listes déroulantes
ch.addItemListener(this);
ch2.addItemListener(this);
ch3.addItemListener(this);
// ajout d'un écouteur d'item sur les boutons radios
rad1.addItemListener(this);
rad2.addItemListener(this);
rad3.addItemListener(this);
rad4.addItemListener(this);
rad5.addItemListener(this);
rad6.addItemListener(this);
rad6.addItemListener(this);
//codeabo.addActionListener(this);
/*codeabo.addActionListener();new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(codeconnu.equals(codeabo.getText()))
System.out.println("Les chaines sont égales");
}
}); */
// ajout d'un écouteur d'action sur le bouton
ok.addActionListener(this);
// ajout d'un écouteur d'év. fenêtre sur la fenêtre
this.addWindowListener(new FenetreAdaptateur());
}
/* public void init() {
// Création d'une image et lancement de son chargement
//image = getImage (getDocumentBase(),"bodega.jpg");
java.awt.Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
Image image = toolkit.getImage("bodega.jpg");
//Image java.applet.Applet.getImage("bodega.jpg");
prepareImage (image, this);
}
public void paint (Graphics gc) {
// Si le chargement de l'image est terminé, affichage de l'image
// sinon affichage d'une chaîne de caractères d'attente
if (chargementTermine)
gc.drawImage (image, 0, 0, this);
else
gc.drawString ("Chargement en cours...", 10, size ().height - 10);
}
// Méthode appelée pour communiquer les étapes du chargement de l'image
public boolean imageUpdate (Image image, int infoFlags, int x, int y, int width, int height) {
// Si le chargement est terminé, redessin de l'applet
if ((infoFlags & ALLBITS) != 0) {
chargementTermine = true;
repaint ();
}
return (infoFlags & (ALLBITS | ABORT)) == 0;
}*/
// comparaison du code abonné entré par l'utilisateur et ceux connus
/*void compare() {
testcode.setText("Coucou");
//codeent = new String(codeabo.getText());
//codeent = codeabo.getText();
if (codeconnu.equals(codeent)) {
testcode.setText("Code abonne valide");*/
/*if (verif == 1) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 1.50;
this.txchange();
} else {
total = 1.50;
montant.add(new Float(total).toString());
}
}*/
/*} else {
testcode.setText("Code abonne invalide");
}
}*/
//}
void txchange() {
montant.removeAll();
if (dev == 1){
total1 = (total);
montant.add(new Float(total1).toString());
}
if (dev == 2){
total2 = (total * 1.2);
montant.add(new Float(total2).toString());
}
if (dev == 3){
total3 = (total * 0.7);
montant.add(new Float(total3).toString());
}
if (dev == 4){
total4 = (total*1.5);
montant.add(new Float(total4).toString());
}
}
public void itemStateChanged (ItemEvent evt) {
int numItem = ch.getSelectedIndex();
if (evt.getSource() == ch)
ch2.removeAll();
if(ch2.getItemCount()<2){
switch (numItem) {
case 0:
{ ch2.addItem("------");
break ; }
case 1:
{ ch2.addItem("------");
ch2.addItem("Danny the dog");
ch2.addItem("Elektra");
ch2.addItem("Kill Bill vol.1");
ch2.addItem("Kill Bill vol.2");
ch2.addItem("Mr & Mrs Smith");
ch2.addItem("XXX2");
break; }
case 2:
{ ch2.addItem("------");
ch2.addItem("Baby-sittor");
ch2.addItem("Brice de Nice");
ch2.addItem("La coccinelle revient");
ch2.addItem("Les Daltons");
ch2.addItem("Narco");
break; }
case 3:
{ ch2.addItem("------");
ch2.addItem("Creep");
ch2.addItem("La mort dans la peau");
ch2.addItem("Les rivieres pourpres 2");
ch2.addItem("Suspect zero");
break;}
case 4:
{ ch2.addItem("------");
ch2.addItem("Batman begins");
ch2.addItem("Catwoman");
ch2.addItem("Harry Potter et le Prisonnier d'Azkaban");
ch2.addItem("La guerre des mondes");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("Spider-man 2");
break;}
case 5:
{ ch2.addItem("------");
ch2.addItem("Aladdin");
ch2.addItem("Bambi");
ch2.addItem("Cendrillon");
ch2.addItem("Le pôle express");
ch2.addItem("Madagascar");
ch2.addItem("Vaillant");
break;}
}
}
/*int numItem2 = ch.getSelectedIndex();
if (evt.getSource() == ch)
ch2.removeAll();
switch (numItem2) {
case 0:
{ ch2.addItem("------");
break ; }
case 1:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("La guerre des mondes");
ch2.addItem("Batman begins");
ch2.addItem("Freres de sang");
ch2.addItem("Elektra");
ch2.addItem("La nuit des morts vivants");
ch2.addItem("Cendrillon");
break; }
case 2:
{ ch2.addItem("------");
ch2.addItem("Freres de sang");
ch2.addItem("Elektra");
ch2.addItem("La nuit des morts vivants");
ch2.addItem("Cendrillon");
break; }
case 3:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("La guerre des mondes");
ch2.addItem("Batman begins");
ch2.addItem("Freres de sang");
break;}
case 4:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("La guerre des mondes");
break;}
case 5:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
break;}
case 6:
{ ch2.addItem("------");
ch2.addItem("La nuit des morts vivants");
break;}
case 7:
{ ch2.addItem("------");
ch2.addItem("Cendrillon");
break;}
}*/
Object obj = evt.getSource();
String s = (String) evt.getItem();
Checkbox box = gr.getSelectedCheckbox();
Checkbox box2 = gr2.getSelectedCheckbox();
montant.removeAll();
if (box == rad1) {
verif = 1;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 2.40;
this.txchange();
} else {
total = 2.40;
montant.add(new Float(total).toString());
}
} /*else {
this.compare();
}*/
} else if (box == rad2) {
verif = 2;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.20;
this.txchange();
} else {
total = 3.20;
montant.add(new Float(total).toString());
}
} else {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 2.20;
this.txchange();
} else {
total = 2.20;
montant.add(new Float(total).toString());
}
}
} else if (box == rad3) {
verif = 3;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 4.10;
this.txchange();
} else {
total = 4.10;
montant.add(new Float(total).toString());
}
} else {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.00;
this.txchange();
} else {
total = 3.00;
montant.add(new Float(total).toString());
}
}
} else if (box == rad4) {
verif = 4;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 5.10;
this.txchange();
} else {
total = 5.10;
montant.add(new Float(total).toString());
}
} else {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.90;
this.txchange();
} else {
total = 3.90;
montant.add(new Float(total).toString());
}
}
}
/*Object obj2 = evt.getSource();
String s2 = (String) evt.getItem();
Checkbox box2 = gr.getSelectedCheckbox();
Checkbox box3 = gr2.getSelectedCheckbox();
montant.removeAll();
if (box3 == rad5) {
if (box2 == rad1) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 1.50;
this.txchange();
} else {
total = 1.50;
montant.add(new Float(total).toString());
}
} else if (box2 == rad2) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.70;
this.txchange();
} else {
total = 3.70;
montant.add(new Float(total).toString());
}
} else if (box2 == rad3) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 4.90;
this.txchange();
} else {
total = 4.90;
montant.add(new Float(total).toString());
}
} else if (box2 == rad4) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 5.60;
this.txchange();
} else {
total = 5.60;
montant.add(new Float(total).toString());
}
}
}
if (box2 == rad5) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 1.50;
this.txchange();
} else {
total = 1.50;
montant.add(new Float(total).toString());
}
} else if (box2 == rad6) {
} else if (box2 == rad7) {
}*/
int numItem3 = ch3.getSelectedIndex();
if (evt.getSource() == ch3)
switch (numItem3) {
case 0:
{ dev = 1;
this.txchange();
break ; }
case 1:
{ dev = 2;
this.txchange();
break ; }
case 2:
{ dev = 3;
this.txchange();
break; }
case 3:
{ dev = 4;
this.txchange();
break; }
}
}
/* public void itemStateChanged(ItemEvent evt) {
int numItem = ch2.getSelectedIndex();
if ( evt.getSource() == ch2 )
switch ( numItem) {
case 0:
{ image1 = getToolkit().getImage("montebello.jpg");
break ; }
case 1:
{ image1 = getToolkit().getImage("bodega.jpg");
break; }
case 2:
{ image1 = getToolkit().getImage("temple.jpg");
break; }
case 3:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 4:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 5:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 6:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 7:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
}
}*/
public static void main (String arg[]) {
loca f = new loca("Locatheque");
f.setBounds(400, 200, 700, 400);
f.setVisible(true);
}
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
String param = ( (Button) src).getLabel();
if (param == "Valider") System.exit(0);
}
}
class FenetreAdaptateur extends WindowAdapter {
// méthode appelée par le système en réponse à la demande de fermeture de la fenêtre
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent.*;
import javax.swing.*;
import java.lang.*;
import java.awt.image.*;
import java.awt.Toolkit;
[COLOR=Red] import java.applet.*;[/COLOR]
public class loca extends [COLOR=Red]JApplet[/COLOR] implements ActionListener, ItemListener {
private Panel p1, p2, p3;
private TextField codeabo;
private Choice ch, ch2, ch3;
private Button ok;
private Image image;
//private boolean chargementTermine = false;
private CheckboxGroup gr, gr2;
private Checkbox rad1, rad2, rad3, rad4, rad5, rad6, rad7;
private List montant;
private double total, total1, total2, total3, total4;
private float dev;
private int verif;
private String codeent;
private String codeconnu;
private TextField testcode;
public loca(String titre) { //le constructeur
//super (titre);
p1 = new Panel();
p1.setLayout (new GridLayout (10,2));
p1.add (new Label ("Classement par genre :"));
ch = new Choice();
ch.addItem("------");
ch.addItem("Action");
ch.addItem("Comédie");
ch.addItem("Policier");
ch.addItem("Fantastique");
ch.addItem("Dessin anime");
ch.select(0);
p1.add (ch);
p1.add (new Label ("Faites votre choix parmi la liste suivante :"));
ch2 = new Choice();
ch2.addItem("------");
ch2.select(0);
p1.add (ch2);
p1.add (new Label ("Duree de location :"));
p2 = new Panel();
p2.setLayout (new GridLayout (2,2));
gr = new CheckboxGroup();
rad1 = new Checkbox("6h", false, gr);
rad2 = new Checkbox("12h", false , gr);
rad3 = new Checkbox("24h", false , gr);
rad4 = new Checkbox("48h", false , gr);
p2.add (rad1);
p2.add (rad2);
p2.add (rad3);
p2.add (rad4);
p1.add(p2);
p1.add (new Label ("Paiement :"));
p3 = new Panel();
p3.setLayout (new GridLayout (3,1));
gr2 = new CheckboxGroup();
rad5 = new Checkbox("Carte abonne", false, gr2);
rad6 = new Checkbox("CB", true , gr2);
rad7 = new Checkbox("Cheque", false , gr2);
p3.add (rad5);
p3.add (rad6);
p3.add (rad7);
p1.add (p3);
p1.add (new Label ("Code abonne (si paiement par carte abonne) :"));
codeabo = new TextField(" ");
p1.add (codeabo);
p1.add (new Label ("Devise :"));
ch3 = new Choice();
ch3.addItem("Euros (€)");
ch3.addItem("Dollars ($)");
ch3.addItem("Livres (£)");
ch3.addItem("Francs Suisse (CHF)");
ch3.select(0);
p1.add (ch3);
p1.add (new Label ("Montant :"));
montant = new List(1);
p1.add (montant);
p1.add (new Label (""));
ok = new Button("Valider");
p1.add (ok);
testcode = new TextField ("Coucou");
p1.add(testcode);
//JPanel image = new JPanel();
//image.add(ch2);
//image1 = getToolkit().getImage("montebello.jpg");
//p1.add(image);
//public void paintComponent(Graphics g){
//super.paintComponent(g);
//g.drawImage(image1, 0, 0, getWidth(), getHeight(), this);
//}
add (p1);
codeconnu = "src4e05";
//codeent = codeabo.getText();
/*JPanel monjpanel = new JPanel(){
public void paint(Graphics g){
super.paint(g);
Image Background = getToolkit().getImage("bodega.jpg");
g.drawImage(Background, 40, 100, this);
repaint();
}
}*/
// ajout d'écouteurs d'item sur les listes déroulantes
ch.addItemListener(this);
ch2.addItemListener(this);
ch3.addItemListener(this);
// ajout d'un écouteur d'item sur les boutons radios
rad1.addItemListener(this);
rad2.addItemListener(this);
rad3.addItemListener(this);
rad4.addItemListener(this);
rad5.addItemListener(this);
rad6.addItemListener(this);
rad6.addItemListener(this);
//codeabo.addActionListener(this);
/*codeabo.addActionListener();new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(codeconnu.equals(codeabo.getText()))
System.out.println("Les chaines sont égales");
}
}); */
// ajout d'un écouteur d'action sur le bouton
ok.addActionListener(this);
// ajout d'un écouteur d'év. fenêtre sur la fenêtre
//this -> rien = non
this.addWindowListener(new FenetreAdaptateur());
}
/* public void init() {
// Création d'une image et lancement de son chargement
//image = getImage (getDocumentBase(),"bodega.jpg");
java.awt.Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
Image image = toolkit.getImage("bodega.jpg");
//Image java.applet.Applet.getImage("bodega.jpg");
prepareImage (image, this);
}
public void paint (Graphics gc) {
// Si le chargement de l'image est terminé, affichage de l'image
// sinon affichage d'une chaîne de caractères d'attente
if (chargementTermine)
gc.drawImage (image, 0, 0, this);
else
gc.drawString ("Chargement en cours...", 10, size ().height - 10);
}
// Méthode appelée pour communiquer les étapes du chargement de l'image
public boolean imageUpdate (Image image, int infoFlags, int x, int y, int width, int height) {
// Si le chargement est terminé, redessin de l'applet
if ((infoFlags & ALLBITS) != 0) {
chargementTermine = true;
repaint ();
}
return (infoFlags & (ALLBITS | ABORT)) == 0;
}*/
// comparaison du code abonné entré par l'utilisateur et ceux connus
/*void compare() {
testcode.setText("Coucou");
//codeent = new String(codeabo.getText());
//codeent = codeabo.getText();
if (codeconnu.equals(codeent)) {
testcode.setText("Code abonne valide");*/
/*if (verif == 1) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 1.50;
this.txchange();
} else {
total = 1.50;
montant.add(new Float(total).toString());
}
}*/
/*} else {
testcode.setText("Code abonne invalide");
}
}*/
//}
void txchange() {
montant.removeAll();
if (dev == 1){
total1 = (total);
montant.add(new Float(total1).toString());
}
if (dev == 2){
total2 = (total * 1.2);
montant.add(new Float(total2).toString());
}
if (dev == 3){
total3 = (total * 0.7);
montant.add(new Float(total3).toString());
}
if (dev == 4){
total4 = (total*1.5);
montant.add(new Float(total4).toString());
}
}
public void itemStateChanged (ItemEvent evt) {
int numItem = ch.getSelectedIndex();
if (evt.getSource() == ch)
ch2.removeAll();
if(ch2.getItemCount()<2){
switch (numItem) {
case 0:
{ ch2.addItem("------");
break ; }
case 1:
{ ch2.addItem("------");
ch2.addItem("Danny the dog");
ch2.addItem("Elektra");
ch2.addItem("Kill Bill vol.1");
ch2.addItem("Kill Bill vol.2");
ch2.addItem("Mr & Mrs Smith");
ch2.addItem("XXX2");
break; }
case 2:
{ ch2.addItem("------");
ch2.addItem("Baby-sittor");
ch2.addItem("Brice de Nice");
ch2.addItem("La coccinelle revient");
ch2.addItem("Les Daltons");
ch2.addItem("Narco");
break; }
case 3:
{ ch2.addItem("------");
ch2.addItem("Creep");
ch2.addItem("La mort dans la peau");
ch2.addItem("Les rivieres pourpres 2");
ch2.addItem("Suspect zero");
break;}
case 4:
{ ch2.addItem("------");
ch2.addItem("Batman begins");
ch2.addItem("Catwoman");
ch2.addItem("Harry Potter et le Prisonnier d'Azkaban");
ch2.addItem("La guerre des mondes");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("Spider-man 2");
break;}
case 5:
{ ch2.addItem("------");
ch2.addItem("Aladdin");
ch2.addItem("Bambi");
ch2.addItem("Cendrillon");
ch2.addItem("Le pôle express");
ch2.addItem("Madagascar");
ch2.addItem("Vaillant");
break;}
}
}
/*int numItem2 = ch.getSelectedIndex();
if (evt.getSource() == ch)
ch2.removeAll();
switch (numItem2) {
case 0:
{ ch2.addItem("------");
break ; }
case 1:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("La guerre des mondes");
ch2.addItem("Batman begins");
ch2.addItem("Freres de sang");
ch2.addItem("Elektra");
ch2.addItem("La nuit des morts vivants");
ch2.addItem("Cendrillon");
break; }
case 2:
{ ch2.addItem("------");
ch2.addItem("Freres de sang");
ch2.addItem("Elektra");
ch2.addItem("La nuit des morts vivants");
ch2.addItem("Cendrillon");
break; }
case 3:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("La guerre des mondes");
ch2.addItem("Batman begins");
ch2.addItem("Freres de sang");
break;}
case 4:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
ch2.addItem("La guerre des mondes");
break;}
case 5:
{ ch2.addItem("------");
ch2.addItem("Les 4 fantastiques");
break;}
case 6:
{ ch2.addItem("------");
ch2.addItem("La nuit des morts vivants");
break;}
case 7:
{ ch2.addItem("------");
ch2.addItem("Cendrillon");
break;}
}*/
Object obj = evt.getSource();
String s = (String) evt.getItem();
Checkbox box = gr.getSelectedCheckbox();
Checkbox box2 = gr2.getSelectedCheckbox();
montant.removeAll();
if (box == rad1) {
verif = 1;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 2.40;
this.txchange();
} else {
total = 2.40;
montant.add(new Float(total).toString());
}
} /*else {
this.compare();
}*/
} else if (box == rad2) {
verif = 2;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.20;
this.txchange();
} else {
total = 3.20;
montant.add(new Float(total).toString());
}
} else {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 2.20;
this.txchange();
} else {
total = 2.20;
montant.add(new Float(total).toString());
}
}
} else if (box == rad3) {
verif = 3;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 4.10;
this.txchange();
} else {
total = 4.10;
montant.add(new Float(total).toString());
}
} else {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.00;
this.txchange();
} else {
total = 3.00;
montant.add(new Float(total).toString());
}
}
} else if (box == rad4) {
verif = 4;
if((box2 == rad6) || (box2 == rad7)) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 5.10;
this.txchange();
} else {
total = 5.10;
montant.add(new Float(total).toString());
}
} else {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.90;
this.txchange();
} else {
total = 3.90;
montant.add(new Float(total).toString());
}
}
}
/*Object obj2 = evt.getSource();
String s2 = (String) evt.getItem();
Checkbox box2 = gr.getSelectedCheckbox();
Checkbox box3 = gr2.getSelectedCheckbox();
montant.removeAll();
if (box3 == rad5) {
if (box2 == rad1) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 1.50;
this.txchange();
} else {
total = 1.50;
montant.add(new Float(total).toString());
}
} else if (box2 == rad2) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 3.70;
this.txchange();
} else {
total = 3.70;
montant.add(new Float(total).toString());
}
} else if (box2 == rad3) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 4.90;
this.txchange();
} else {
total = 4.90;
montant.add(new Float(total).toString());
}
} else if (box2 == rad4) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 5.60;
this.txchange();
} else {
total = 5.60;
montant.add(new Float(total).toString());
}
}
}
if (box2 == rad5) {
if ((dev == 2) || (dev ==3) || (dev==4)) {
total = 1.50;
this.txchange();
} else {
total = 1.50;
montant.add(new Float(total).toString());
}
} else if (box2 == rad6) {
} else if (box2 == rad7) {
}*/
int numItem3 = ch3.getSelectedIndex();
if (evt.getSource() == ch3)
switch (numItem3) {
case 0:
{ dev = 1;
this.txchange();
break ; }
case 1:
{ dev = 2;
this.txchange();
break ; }
case 2:
{ dev = 3;
this.txchange();
break; }
case 3:
{ dev = 4;
this.txchange();
break; }
}
}
/* public void itemStateChanged(ItemEvent evt) {
int numItem = ch2.getSelectedIndex();
if ( evt.getSource() == ch2 )
switch ( numItem) {
case 0:
{ image1 = getToolkit().getImage("montebello.jpg");
break ; }
case 1:
{ image1 = getToolkit().getImage("bodega.jpg");
break; }
case 2:
{ image1 = getToolkit().getImage("temple.jpg");
break; }
case 3:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 4:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 5:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 6:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
case 7:
{ image1 = getToolkit().getImage("bodega.jpg");
break;}
}
}*/
[COLOR=Red]public void init[/COLOR] (String arg[]) {
loca f = new loca("Locatheque");
f.setBounds(400, 200, 700, 400);
f.setVisible(true);
}
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
String param = ( (Button) src).getLabel();
if (param == "Valider") System.exit(0);
}
}
class FenetreAdaptateur extends WindowAdapter {
// méthode appelée par le système en réponse à la demande de fermeture de la fenêtre
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
loca.java:159: cannot find symbol
symbol : method addWindowListener(FenetreAdapteur)
location : class loca
this.addWindowListener(new FenetreAdapteur());