IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

Integration d interface graphique Swing


Sujet :

AWT/Swing Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2013
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2013
    Messages : 14
    Par défaut Integration d interface graphique Swing
    bonsoir a tous
    j aurai besoin de quelque conseil concernant mon programme.enfaite il s agit de la gestion de la paye d une entreprise.je suis qu en 1 iere année alors c est un peu basique comme programme.on a plusieurs classes avec héritage.le soucis c est qu on nous a demandé d integrer une interface graphique alors que je n ai aucune notion la dessus et je n arrive a l integrer a mon programme.je vous montre ce que j ai fait
    voici la classe principale avec le main.dans la classe je declare les tableau que j utilise dans le programme et dans le main il y a l exécution de la fenêtre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
     
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
     
    public class GestionPaie{
     
     
    	public static Date AnneeAct=new Date(12,5,2014);
    	{	
    	    Employé[] emp = new Employé[10];
    		 Facture[] fact = new Facture[10];
     
    //Factures
     
    		 double mt=0;		    
    		     fact[0]= new Facture(1); 
    		           fact[0].liste[0]= new Produit("prod1",20,1002);
    		           mt+=fact[0].liste[0].montnpartiel;
    		           fact[0].liste[1]= new Produit("prod2",30,700);
    		           mt+=fact[0].liste[1].montnpartiel;
    		           fact[0].liste[2]= new Produit("prod3",20,300.5);
    		           mt+=fact[0].liste[2].montnpartiel;
    		           fact[0].liste[3]= new Produit("prod4",10,500.5);
    		           mt+=fact[0].liste[3].montnpartiel;
    		           fact[0].liste[4]= new Produit("prod5",40,20);
    		           mt+=fact[0].liste[4].montnpartiel;
    		           fact[0].liste[5]= new Produit("prod6",5,2000.0);
    		           mt+=fact[0].liste[5].montnpartiel;
    		           fact[0].liste[6]= new Produit("prod7",60,100);
    		           mt+=fact[0].liste[6].montnpartiel;
    		           fact[0].liste[7]= new Produit("prod8",16,350);
    		           mt+=fact[0].liste[7].montnpartiel;
    		           fact[0].liste[8]= new Produit("prod9",65,7);
    		           mt+=fact[0].liste[8].montnpartiel;
    		           fact[0].liste[9]= new Produit("prod10",20,25);
    		           mt+=fact[0].liste[9].montnpartiel;
    		           fact[0].montantotalapaye=mt;
    		           mt=0;
     
     
    		      fact[1]= new Facture(2); 
    		           fact[1].liste[0]= new Produit("prod1",25,1002);
    		           mt+=fact[1].liste[0].montnpartiel;
    		           fact[1].liste[1]= new Produit("prod2",32,700);
    		           mt+=fact[1].liste[1].montnpartiel;
    		           fact[1].liste[2]= new Produit("prod3",4,300.5);
    		           mt+=fact[1].liste[2].montnpartiel;
    		           fact[1].liste[3]= new Produit("prod4",1,500.5);
    		           mt+=fact[1].liste[3].montnpartiel;
    		           fact[1].liste[4]= new Produit("prod5",23,20);
    		           mt+=fact[1].liste[4].montnpartiel;
    		           fact[1].liste[5]= new Produit("prod6",7,2000.0);
    		           mt+=fact[1].liste[5].montnpartiel;
    		           fact[1].liste[6]= new Produit("prod7",40,100);
    		           mt+=fact[1].liste[6].montnpartiel;
    		           fact[1].liste[7]= new Produit("prod8",27,350);
    		           mt+=fact[1].liste[7].montnpartiel;
    		           fact[1].liste[8]= new Produit("prod9",55,7);
    		           mt+=fact[1].liste[8].montnpartiel;
    		           fact[1].liste[9]= new Produit("prod10",9,25);
    		           mt+=fact[1].liste[9].montnpartiel;
    		           fact[1].montantotalapaye=mt;
    		           mt=0;
     
     
    		      fact[2]= new Facture(3); 
    		           fact[2].liste[0]= new Produit("prod1",20,1002);
    		           mt+=fact[2].liste[0].montnpartiel;
    		           fact[2].liste[1]= new Produit("prod2",33,700);
    		           mt+=fact[2].liste[1].montnpartiel;
    		           fact[2].liste[2]= new Produit("prod3",18,300.5);
    		           mt+=fact[2].liste[2].montnpartiel;
    		           fact[2].liste[3]= new Produit("prod4",13,500.5);
    		           mt+=fact[2].liste[3].montnpartiel;
    		           fact[2].liste[4]= new Produit("prod5",35,20);
    		           mt+=fact[2].liste[4].montnpartiel;
    		           fact[2].liste[5]= new Produit("prod6",9,2000.0);
    		           mt+=fact[2].liste[5].montnpartiel;
    		           fact[2].liste[6]= new Produit("prod7",72,100);
    		           mt+=fact[2].liste[6].montnpartiel;
    		           fact[2].liste[7]= new Produit("prod8",16,350);
    		           mt+=fact[2].liste[7].montnpartiel;
    		           fact[2].liste[8]= new Produit("prod9",47,7);
    		           mt+=fact[2].liste[8].montnpartiel;
    		           fact[2].liste[9]= new Produit("prod10",19,25);
    		           mt+=fact[2].liste[9].montnpartiel;
    		           fact[2].montantotalapaye=mt;
    		           mt=0;
     
     
    		      fact[3]= new Facture(4); 
    		           fact[3].liste[0]= new Produit("prod1",9,1002);
    		           mt+=fact[3].liste[0].montnpartiel;
    		           fact[3].liste[1]= new Produit("prod2",34,700);
    		           mt+=fact[3].liste[1].montnpartiel;
    		           fact[3].liste[2]= new Produit("prod3",22,300.5);
    		           mt+=fact[3].liste[2].montnpartiel;
    		           fact[3].liste[3]= new Produit("prod4",13,500.5);
    		           mt+=fact[3].liste[3].montnpartiel;
    		           fact[3].liste[4]= new Produit("prod5",29,20);
    		           mt+=fact[3].liste[4].montnpartiel;
    		           fact[3].liste[5]= new Produit("prod6",8,2000.0);
    		           mt+=fact[3].liste[5].montnpartiel;
    		           fact[3].liste[6]= new Produit("prod7",30,100);
    		           mt+=fact[3].liste[6].montnpartiel;
    		           fact[3].liste[7]= new Produit("prod8",26,350);
    		           mt+=fact[3].liste[7].montnpartiel;
    		           fact[3].liste[8]= new Produit("prod9",55,7);
    		           mt+=fact[3].liste[8].montnpartiel;
    		           fact[3].liste[9]= new Produit("prod10",26,25);
    		           mt+=fact[3].liste[9].montnpartiel;
    		           fact[3].montantotalapaye=mt;
    		           mt=0;
     
     
    		      fact[4]= new Facture(5); 
    		           fact[4].liste[0]= new Produit("prod1",12,1002);
    		           mt+=fact[4].liste[0].montnpartiel;
    		           fact[4].liste[1]= new Produit("prod2",40,700);
    		           mt+=fact[4].liste[1].montnpartiel;
    		           fact[4].liste[2]= new Produit("prod3",24,300.5);
    		           mt+=fact[4].liste[2].montnpartiel;
    		           fact[4].liste[3]= new Produit("prod4",14,500.5);
    		           mt+=fact[4].liste[3].montnpartiel;
    		           fact[4].liste[4]= new Produit("prod5",24,20);
    		           mt+=fact[4].liste[4].montnpartiel;
    		           fact[4].liste[5]= new Produit("prod6",18,2000.0);
    		           mt+=fact[4].liste[5].montnpartiel;
    		           fact[4].liste[6]= new Produit("prod7",36,100);
    		           mt+=fact[4].liste[6].montnpartiel;
    		           fact[4].liste[7]= new Produit("prod8",12,350);
    		           mt+=fact[4].liste[7].montnpartiel;
    		           fact[4].liste[8]= new Produit("prod9",46,7);
    		           mt+=fact[4].liste[8].montnpartiel;
    		           fact[4].liste[9]= new Produit("prod10",21,25);
    		           mt+=fact[4].liste[9].montnpartiel;
    		           fact[4].montantotalapaye=mt;
    		           mt=0;
     
     
    		      fact[5]= new Facture(6); 
    		           fact[5].liste[0]= new Produit("prod1",16,1002);
    		           mt+=fact[5].liste[0].montnpartiel;
    		           fact[5].liste[1]= new Produit("prod2",27,700);
    		           mt+=fact[5].liste[1].montnpartiel;
    		           fact[5].liste[2]= new Produit("prod3",38,300.5);
    		           mt+=fact[5].liste[2].montnpartiel;
    		           fact[5].liste[3]= new Produit("prod4",10,500.5);
    		           mt+=fact[5].liste[3].montnpartiel;
    		           fact[5].liste[4]= new Produit("prod5",3,20);
    		           mt+=fact[5].liste[4].montnpartiel;
    		           fact[5].liste[5]= new Produit("prod6",7,2000.0);
    		           mt+=fact[5].liste[5].montnpartiel;
    		           fact[5].liste[6]= new Produit("prod7",60,100);
    		           mt+=fact[5].liste[6].montnpartiel;
    		           fact[5].liste[7]= new Produit("prod8",36,350);
    		           mt+=fact[5].liste[7].montnpartiel;
    		           fact[5].liste[8]= new Produit("prod9",25,7);
    		           mt+=fact[5].liste[8].montnpartiel;
    		           fact[5].liste[9]= new Produit("prod10",14,25);
    		           mt+=fact[5].liste[9].montnpartiel;
    		           fact[5].montantotalapaye=mt;
    		           mt=0;
     
     
    		      fact[6]= new Facture(7); 
    		           fact[6].liste[0]= new Produit("prod1",38,1002);
    		           mt+=fact[6].liste[0].montnpartiel;
    		           fact[6].liste[1]= new Produit("prod2",3,700);
    		           mt+=fact[6].liste[1].montnpartiel;
    		           fact[6].liste[2]= new Produit("prod3",40,300.5);
    		           mt+=fact[6].liste[2].montnpartiel;
    		           fact[6].liste[3]= new Produit("prod4",7,500.5);
    		           mt+=fact[6].liste[3].montnpartiel;
    		           fact[6].liste[4]= new Produit("prod5",9,20);
    		           mt+=fact[6].liste[4].montnpartiel;
    		           fact[6].liste[5]= new Produit("prod6",5,2000.0);
    		           mt+=fact[6].liste[5].montnpartiel;
    		           fact[6].liste[6]= new Produit("prod7",70,100);
    		           mt+=fact[6].liste[6].montnpartiel;
    		           fact[6].liste[7]= new Produit("prod8",26,350);
    		           mt+=fact[6].liste[7].montnpartiel;
    		           fact[6].liste[8]= new Produit("prod9",45,7);
    		           mt+=fact[6].liste[8].montnpartiel;
    		           fact[6].liste[9]= new Produit("prod10",18,25);
    		           mt+=fact[6].liste[9].montnpartiel;
    		           fact[6].montantotalapaye=mt;
    		           mt=0;
     
     
    		     fact[7]= new Facture(8); 
    		           fact[7].liste[0]= new Produit("prod1",9,1002);
    		           mt+=fact[7].liste[0].montnpartiel;
    		           fact[7].liste[1]= new Produit("prod2",40,700);
    		           mt+=fact[7].liste[1].montnpartiel;
    		           fact[7].liste[2]= new Produit("prod3",50,300.5);
    		           mt+=fact[7].liste[2].montnpartiel;
    		           fact[7].liste[3]= new Produit("prod4",10,500.5);
    		           mt+=fact[7].liste[3].montnpartiel;
    		           fact[7].liste[4]= new Produit("prod5",40,20);
    		           mt+=fact[7].liste[4].montnpartiel;
    		           fact[7].liste[5]= new Produit("prod6",2,2000.0);
    		           mt+=fact[7].liste[5].montnpartiel;
    		           fact[7].liste[6]= new Produit("prod7",18,100);
    		           mt+=fact[7].liste[6].montnpartiel;
    		           fact[7].liste[7]= new Produit("prod8",16,350);
    		           mt+=fact[7].liste[7].montnpartiel;
    		           fact[7].liste[8]= new Produit("prod9",12,7);
    		           mt+=fact[7].liste[8].montnpartiel;
    		           fact[7].liste[9]= new Produit("prod10",2,25);
    		           mt+=fact[7].liste[9].montnpartiel;
    		           fact[7].montantotalapaye=mt;
    		           mt=0;      
     
    		     fact[8]= new Facture(9); 
    		           fact[8].liste[0]= new Produit("prod1",34,1002);
    		           mt+=fact[8].liste[0].montnpartiel;
    		           fact[8].liste[1]= new Produit("prod2",5,700);
    		           mt+=fact[8].liste[1].montnpartiel;
    		           fact[8].liste[2]= new Produit("prod3",27,300.5);
    		           mt+=fact[8].liste[2].montnpartiel;
    		           fact[8].liste[3]= new Produit("prod4",11,500.5);
    		           mt+=fact[8].liste[3].montnpartiel;
    		           fact[8].liste[4]= new Produit("prod5",33,20);
    		           mt+=fact[8].liste[4].montnpartiel;
    		           fact[8].liste[5]= new Produit("prod6",3,2000.0);
    		           mt+=fact[8].liste[5].montnpartiel;
    		           fact[8].liste[6]= new Produit("prod7",63,100);
    		           mt+=fact[8].liste[6].montnpartiel;
    		           fact[8].liste[7]= new Produit("prod8",13,350);
    		           mt+=fact[8].liste[7].montnpartiel;
    		           fact[8].liste[8]= new Produit("prod9",43,7);
    		           mt+=fact[8].liste[8].montnpartiel;
    		           fact[8].liste[9]= new Produit("prod10",10,25);
    		           mt+=fact[8].liste[9].montnpartiel;
    		           fact[8].montantotalapaye=mt;
    		           mt=0;
     
     
    		     fact[9]= new Facture(9); 
    		           fact[9].liste[0]= new Produit("prod1",11,1002);
    		           mt+=fact[9].liste[0].montnpartiel;
    		           fact[9].liste[1]= new Produit("prod2",22,700);
    		           mt+=fact[9].liste[1].montnpartiel;
    		           fact[9].liste[2]= new Produit("prod3",32,300.5);
    		           mt+=fact[9].liste[2].montnpartiel;
    		           fact[9].liste[3]= new Produit("prod4",12,500.5);
    		           mt+=fact[9].liste[3].montnpartiel;
    		           fact[9].liste[4]= new Produit("prod5",33,20);
    		           mt+=fact[9].liste[4].montnpartiel;
    		           fact[9].liste[5]= new Produit("prod6",4,2000.0);
    		           mt+=fact[9].liste[5].montnpartiel;
    		           fact[9].liste[6]= new Produit("prod7",40,100);
    		           mt+=fact[9].liste[6].montnpartiel;
    		           fact[9].liste[7]= new Produit("prod8",16,350);
    		           mt+=fact[9].liste[7].montnpartiel;
    		           fact[9].liste[8]= new Produit("prod9",55,7);
    		           mt+=fact[9].liste[8].montnpartiel;
    		           fact[9].liste[9]= new Produit("prod10",21,25);
    		           mt+=fact[9].liste[9].montnpartiel;
    		           fact[9].montantotalapaye=mt;
     
     
     
    //Vacataires
     
    		    double vb=0;
     
                Date da= new Date(0,0,0);
    		    da.Jour=2;
    		    da.Mois=5;
    		    da.Annee=1967;
    		    emp[0]=new Employé("Deb","Nas",1,da);
     
    		    vb= fact[0].montantotalapaye+fact[1].montantotalapaye;
    		    EmployéVacataire emp1 = new EmployéVacataire(emp[0].Nom,emp[0].Prenom,emp[0].NSS,emp[0].D,100);
    		     String A1=emp1.Afficher();
     
    		    da.Jour=6;
    		    da.Mois=3;
    		    da.Annee=1963;
    		   emp[1]=new Employé("Del","Yac",2,da);
     
    		   vb= fact[1].montantotalapaye+fact[2].montantotalapaye;
    		   EmployéVacataire emp2= new EmployéVacataire(emp[1].Nom,emp[1].Prenom,emp[1].NSS,emp[1].D,70);
    		   String A2=  emp2.Afficher();
     
    		//Salariés
     
    		    da.Jour=3;
    		    da.Mois=11;
    		    da.Annee=1963;
    		   emp[2]=new Employé("Bel" ,"Mok",3,da);
     
    		   vb= fact[2].montantotalapaye+fact[3].montantotalapaye;
    		   EmployéSalarié emp3=new EmployéSalarié(emp[2].Nom,emp[2].Prenom,emp[2].NSS,emp[2].D,vb,5000);
    		   String A3=  emp3.Afficher();
     
    		    da.Jour=4;
    		    da.Mois=9;
    		    da.Annee=1951;
    		   emp[3]=new Employé("Yed","Id",4,da);
     
    		   vb= fact[3].montantotalapaye+fact[4].montantotalapaye;
    		   EmployéSalarié emp4=new EmployéSalarié(emp[3].Nom,emp[3].Prenom,emp[3].NSS,emp[3].D,vb,5000);
    		   String A4=  emp4.Afficher();
     
    		//Commissionnaires salariés
     
    		    da.Jour=7;
    		    da.Mois=2;
    		    da.Annee=1975;
    		   emp[4]=new Employé("Lek","Souh",5,da);
     
    		   vb= fact[4].montantotalapaye+fact[5].montantotalapaye;
    		   EmployéCommissionnaireSalarié emp5=new EmployéCommissionnaireSalarié(emp[4].Nom,emp[4].Prenom,emp[4].NSS,emp[4].D,vb,5,15000);
    		   String A5=  emp5.Afficher();
     
    		    da.Jour=29;
    		    da.Mois=3;
    		    da.Annee=1987;
    		   emp[5]=new Employé("Boda","Moumen",6,da);
     
    		   vb= fact[5].montantotalapaye+fact[6].montantotalapaye;
    		   EmployéCommissionnaireSalarié emp6 =new EmployéCommissionnaireSalarié(emp[5].Nom,emp[5].Prenom,emp[5].NSS,emp[5].D,vb,5,15000);
    		   String A6=  emp6.Afficher();
     
    		    da.Jour=2;
    		    da.Mois=7;
    		    da.Annee=1985;
    		   emp[6]=new Employé("Boulekroun","Yasser",7,da);
     
    		   vb= fact[6].montantotalapaye+fact[7].montantotalapaye;
    		   EmployéCommissionnaireSalarié emp7=new EmployéCommissionnaireSalarié(emp[6].Nom,emp[6].Prenom,emp[6].NSS,emp[6].D,vb,5,15000);
    		   String A7=  emp7.Afficher();
    		//Commissionnaires
     
    		    da.Jour=22;
    		    da.Mois=9;
    		    da.Annee=1983;
    		   emp[7]=new Employé("Boudour","Mosaab",8,da);
     
    		   vb= fact[7].montantotalapaye+fact[8].montantotalapaye;
    		   EmployéCommissionnaire emp8=new EmployéCommissionnaire(emp[7].Nom,emp[7].Prenom,emp[7].NSS,emp[7].D,vb,10);
    		   String A8=  emp8.Afficher();
     
    		    da.Jour=13;
    		    da.Mois=2;
    		    da.Annee=1981;
    		   emp[8]=new Employé("Khantol","Nasredine",9,da);
     
    		   vb= fact[8].montantotalapaye+fact[9].montantotalapaye;
    		   EmployéCommissionnaire emp9=new EmployéCommissionnaire(emp[8].Nom,emp[8].Prenom,emp[8].NSS,emp[8].D,vb,10);
    		   String A9=  emp9.Afficher();
     
    		    da.Jour=3;
    		    da.Mois=5;
    		    da.Annee=1976;
    		   emp[9]=new Employé("Gellati","Mohamed AbdelHalim",10,da);
     
    		   vb= fact[9].montantotalapaye+fact[0].montantotalapaye;
    		   EmployéCommissionnaire emp10=new EmployéCommissionnaire(emp[9].Nom,emp[9].Prenom,emp[9].NSS,emp[9].D,vb,10);
    		   String A10=  emp10.Afficher();
     
    	}
     
    		   public static void main(String[] args){
     
    			   SwingUtilities.invokeLater(new Runnable(){
    				    public void run(){
    				     SimpleFenetre fenetre = new SimpleFenetre();
    				     fenetre.setVisible(true);
    				    }
    				   }); 
     
    	}
    }
    et voici la classe simplefenetre ou je crée mon interface graphique

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    import javax.swing.AbstractAction;
    import javax.swing.JLabel;
    import javax.swing.JMenuBar;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JOptionPane;
    import javax.swing.SwingUtilities;
    
    
    	 public class SimpleFenetre extends JFrame {
    		
    	   public SimpleFenetre(){
    	     super();
    
    	     build();//On initialise notre fenêtre
    	    }
    
    	   private void build(){
    	    setTitle("Gestion paye"); //On donne un titre à l'application
    	    setSize(320,240); //On donne une taille à notre fenêtre
    	    setLocationRelativeTo(null); //On centre la fenêtre sur l'écran
    	    setResizable(false); //On interdit la redimensionnement de la fenêtre
    
    	    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à l'application de se fermer lors du clic sur la croix
    	    setContentPane(buildContentPane());
    
    
    	  JMenuBar menuBar = new JMenuBar();
    	     JMenu menu1 = new JMenu("Gestion paie");
    	     JMenu menu2 = new JMenu("Employe");
    
    	     
    	    
    	   JMenuItem emp1 = new JMenuItem(new Emp1Action(this, "emp1"));
    	   menu2.add(emp1);
    
    	   JMenuItem emp2 = new JMenuItem(new Emp2Action(this, "emp2"));
    	   menu2.add(emp2);
    
    	   JMenuItem emp3 = new JMenuItem(new Emp3Action(this, "emp3"));
    	   menu2.add(emp3);
    
    	   JMenuItem emp4 = new JMenuItem(new Emp4Action(this, "emp4"));
    	   menu2.add(emp4);
    
    	   JMenuItem emp5 = new JMenuItem(new Emp5Action(this, "emp5"));
    	   menu2.add(emp5);
    
    	   JMenuItem emp6 = new JMenuItem(new Emp6Action(this, "emp6"));
    	   menu2.add(emp6);
    
    	   JMenuItem emp7 = new JMenuItem(new Emp7Action(this, "emp7"));
    	   menu2.add(emp7);
    
    	   JMenuItem emp8 = new JMenuItem(new Emp8Action(this, "emp8"));
    	   menu2.add(emp8);
    
    	   JMenuItem emp9 = new JMenuItem(new Emp9Action(this, "emp9"));
    	   menu2.add(emp9);
    
    	   JMenuItem emP10 = new JMenuItem(new Emp10Action(this, "emP10"));
    	   menu2.add(emP10);
    
    	   menu1.add(menu2);
    	   
    	   JMenu menu3 = new JMenu(" affiche?");
    	   menu1.add(menu3);
    	   
    	   JMenuItem Employesup50anns = new JMenuItem(new Emp50annsAction(this, "Employesup50anns"));
    	   menu3.add(Employesup50anns);
    	   menu1.add(menu3);
    	   
    	   JMenu menu4 = new JMenu("3emeAffichage?");
    	  
    	   
    	   JMenuItem Aff3 = new JMenuItem(new Affichage3Action(this, "Aff3"));
    	   menu4.add(Aff3);
    	   menu1.add(menu4);
    
    	  menuBar.add(menu1);
    	  setJMenuBar(menuBar);
    
    
    	  }
    	 
    	//ajouter le text dans la fenetre
    
    	  private JPanel buildContentPane(){
    	  JPanel panel = new JPanel();
    	  panel.setLayout(new FlowLayout());
    	  panel.setBackground(Color.white);
    
    	  JLabel label = new JLabel("Bienvenue dans ma modeste application");
    	  panel.add(label);
    	  return panel;
    	  }
    	 
    
    	 public class Emp50annsAction extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp50annsAction(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    		   
    		   public void actionPerformed(ActionEvent e) {
    		   JOptionPane.showMessageDialog(fenetre, "La liste des employe > 50 anns");
    		   }
    		 }  
    
    
    
    		  public class Affichage3Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Affichage3Action (SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    		   public void actionPerformed(ActionEvent e) {
    		   JOptionPane.showMessageDialog(fenetre,"Faire le 3eme affichage");
    		   }
    		 }  
    
    
    
    
    		 // test (Aff = test.getemp1) c'est la classe de main() 
              
    		  public class Emp1Action extends AbstractAction {
    		   public  GestionPaie E=new GestionPaie();
    		   private SimpleFenetre fenetre;
    		   public Emp1Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    		   
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,E.A);
    		  }
    		 }
    
    
    		  public class Emp2Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp2Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    		   
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"E.A2");
    		  }
    		 }
    
    
    		  public class Emp3Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp3Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,emp3.Afficher());
    		  }
    		 }
    
    
    		  public class Emp4Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp4Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp4.Afficher()");
    		  }
    		 }
    
    
    		  public class Emp5Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp5Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp5.Afficher()");
    		  }
    		 }
    
    
    		  public class Emp6Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp6Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp6.Afficher()");
    		  }
    		 }
    
    
    		  public class Emp7Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp7Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp7.Afficher()");
    		  }
    		 }
    
    
    		  public class Emp8Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp8Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp8.Afficher()");
    		  }
    		 }
    
    
    		  public class Emp9Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp9Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp9.Afficher()");
    		  }
    		 }
    
    
    		  public class Emp10Action extends AbstractAction {
    		   private SimpleFenetre fenetre;
    		   public Emp10Action(SimpleFenetre fenetre, String texte){
    		    super(texte);
    		    this.fenetre = fenetre;
    		   }
    
    
    		  public void actionPerformed(ActionEvent e) {
    		  //Action lors du clic sur le bouton calculer
    		  JOptionPane.showMessageDialog(fenetre,"emp10.Afficher()");
    		  }
    }
    	
    		  }
    je réussi a avoir l interface mais qu on je choisi l employé je n arrive pas a avoir les infos sur mon employé.j ai essayé plusieurs truk comme vous le voyais mais en vain.je sais que c un peu le desordre mais quelque conseils seraient les bienvenus^^merci

  2. #2
    Membre actif
    Homme Profil pro
    Inscrit en
    Septembre 2013
    Messages
    149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Septembre 2013
    Messages : 149
    Par défaut
    Salut,

    Il faut que chaque valeur que tu veux récupérer dans ta classe GestionPaie soit une méthode.
    Tu créé ensuite un objet GestionPaie et tu appelle tes méthodes pour récupérer les données.

    Exemple:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    public String nomDeLEmploye () {
         String nom = /*Instruction pour avoir le nom de l'employé*/;
         return nom;
    }
    Et dans ta fenêtre tu fais ainsi:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    GestionPaie gp = new GestionPaie();
    ...
    String nom = gp.nomDeLEmploye();

Discussions similaires

  1. integrer firefox dans une interface graphique swing
    Par fraisa1985 dans le forum AWT/Swing
    Réponses: 8
    Dernier message: 21/06/2011, 12h15
  2. Message d'erreur interface graphique swing
    Par oclone dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 16/01/2008, 13h44
  3. Interface graphique, swing ?
    Par Palleas dans le forum Développement Mobile en Java
    Réponses: 3
    Dernier message: 10/10/2007, 14h35
  4. interface graphique swing
    Par franfr57 dans le forum AWT/Swing
    Réponses: 7
    Dernier message: 14/11/2006, 02h05
  5. [Swing] Création d'une interface graphique SWING + MVC
    Par Sylmandel dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 21/04/2006, 09h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo