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
|
import java.awt.*;
import java.awt.event.*;
import java.awt.Image;
public class ElementParam extends Panel implements ActionListener
{
String cinpc, dixc, vingtc, cinquc, uneurro;
public ElementParam(Monnayeur m)
{
Label cinp = new Label("5 centimes");
TextField cinpc = new TextField(10);
cinpc.addActionListener(new Stockpiece(5,m));
this.add(cinpc);
Label dix = new Label("10 centimes");
TextField dixc = new TextField(10);
dixc.addActionListener(new Stockpiece(4,m));
this.add(dixc);
Label vingt = new Label("20 centimes");
TextField vingtc = new TextField(10);
vingtc.addActionListener(new Stockpiece(3,m));
this.add(vingtc);
Label cinquante = new Label("50 centimes");
TextField cinquc = new TextField(10);
cinquc.addActionListener(new Stockpiece(2,m));
this.add(cinquc);
Label un = new Label("1 euro");
TextField uneurro = new TextField(10);
uneurro.addActionListener(new Stockpiece(1,m));
this.add(uneurro);
Button valide = new Button("Valider");
valide.addActionListener(this);
Image quit=getImage(getDocumentBase(),"machine a café/image/fermerparam.JPEG");
Label bquit = new Label(new ImageIcon(quit));
}
public static int getPieces5Centimes()
{
int nb5c = 0 ;
String texteDansCinpc = cinpc.getText() ;
if ( texteDansCinpc != null && texteDansCinpc.length() > 0 )
{
nb5c = Integer.parseInt( texteDansCinpc );
}
return nb5c ;
}
public static int getPieces10Centimes()
{
int nb10c = 0 ;
String texteDansDixc = dixc.getText() ;
if ( texteDansDixc != null && texteDansDixc.length() > 0 )
{
nb10c = Integer.parseInt( texteDansDixc );
}
return nb10c ;
}
public static int getPieces20Centimes()
{
int nb20c = 0 ;
String texteDansvingtc = vingtc.getText() ;
if ( texteDansvingtc != null && texteDansvingtc.length() > 0 )
{
nb20c = Integer.parseInt( texteDansvingtc );
}
return nb20c ;
}
public static int getPieces50Centimes()
{
int nb50c = 0 ;
String texteDanscinquc = cinquc.getText() ;
if ( texteDanscinquc != null && texteDanscinquc.length() > 0 )
{
nb50c = Integer.parseInt( texteDanscinquc );
}
return nb50c ;
}
public static int getPieces1euuro()
{
int nb1e = 0 ;
String texteDansuneurro = uneurro.getText() ;
if ( texteDansuneurro != null && texteDansuneurro.length() > 0 )
{
nb1e = Integer.parseInt( texteDansuneurro );
}
return nb1e ;
} |
Partager