| 12
 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
 
 | package package1;
/**
*
* @author Antoine
*/
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
import java.applet.Applet;
import java.awt.Graphics; 
import java.awt.Polygon;
public class FicheRenseignement extends Applet {
static JPanel panneau=new JPanel();
static GridLayout layout=new GridLayout(4,2);
static JLabel label1=new JLabel("Nom");
static JLabel label2=new JLabel("Prénom");
static JLabel label3=new JLabel("Nationalité (Française et Algérienne prisent en charge)");
static JTextField text1=new JTextField(5);
static JTextField text2=new JTextField(5);
static JTextField text3=new JTextField(5);
static JButton bouton=new JButton("OK");
static JFrame fenetre=new JFrame("Fiche de renseignement");    
 
   public static void main(String[] args) {
 
       Moteur moteur=new Moteur();
       panneau.setLayout(layout);
       panneau.add(label1);
       panneau.add(text1);         
       panneau.add(label2);
       panneau.add(text2);
       panneau.add(label3);
       panneau.add(text3);
       panneau.add(bouton);
       bouton.addActionListener(moteur);
       fenetre.setContentPane(panneau);
       fenetre.setSize(800, 200);
       fenetre.setVisible(true);
   }
}
class France extends Applet { 
	/**
         * 
         */
	private static final long serialVersionUID = 1L;
 
	 public void paint(Graphics screen) {
	 screen.drawString("France", 185, 75); 
	 screen.drawLine(185,80,222,80); 
	 int x[] = { 526,541,559,565,617,624,659,662,697,728,746,779,865,837,832,816,793,795,734,732,720,741,745,775,798,780,798,768,792,783,807,838,830,796,762,683,659,652,637,583,537,518,511,464,429,355,210,185,235,251,193,197,151,79,52,76,150,175,253,244,281,286,372,372,451,460 };
	 int y[] = { 59,94,91,116,136,168,173,154,181,208,212,214,247,266,306,387,403,401,418,489,509,523,527,501,499,549,564,606,619,669,694,711,708,747,766,799,796,780,763,782,755,782,830,899,855,852,811,775,747,628,483,422,390,290,280,261,235,232,263,166,166,191,199,185,144,77 };
	 int pts = x.length;
	 Polygon poly = new Polygon(x, y, pts); 
	 screen.drawPolygon(poly); 
 
	   }
	   }
 
 
class Moteur implements ActionListener{
   public void actionPerformed(ActionEvent clique){
       JTextField text1=FicheRenseignement.text1;
       JTextField text2=FicheRenseignement.text2;
       JTextField text3=FicheRenseignement.text3;       
       String nom=text1.getText();
       String prenom=text2.getText();
       String nationalite=text3.getText();
       nationalite=nationalite.toUpperCase();       
       int reponse = 0;           
       JOptionPane.showConfirmDialog(null,"Bonjour "+nom+" "+prenom+" vous êtes de nationalité "+nationalite+".","Fiche de Renseignement",JOptionPane.PLAIN_MESSAGE);
       if(nationalite.equals("FRANÇAISE")||nationalite.equals("ALGÉRIENNE")) {
    	   reponse=JOptionPane.showConfirmDialog(null,"Voulez-vous que l'on vous affiche la carte de votre pays ?","Carte de votre pays ?",JOptionPane.OK_CANCEL_OPTION);
           if(reponse==JOptionPane.OK_OPTION){
        	   if(nationalite.equals("FRANÇAISE")) {
        		   France france=new France();
        		   france.init();
        		   france.start();
        		   france.setVisible(true);
        		   france.validate();
        		           	   }
        	   else {
        		   System.out.println("carte algérie");
        	   }
            }     
           if(reponse==JOptionPane.CANCEL_OPTION){
        	   System.out.println("GoodBye World !");
            }
           if(reponse==JOptionPane.CLOSED_OPTION){
        	   System.out.println("The Fuck World ?");
            }      	   
 
       }
       else {
    	   JOptionPane.showConfirmDialog(null, "Cette nationalité n'est pas prise en compte, veuillez réessayer avec la nationalité française ou algérienne.","Nationalité non prise en charge.",JOptionPane.PLAIN_MESSAGE);
       }
 
}
} | 
Partager