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

Interfaces Graphiques en Java Discussion :

[L&F] encore ..


Sujet :

Interfaces Graphiques en Java

  1. #1
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut [L&F] encore ..
    Bonjour,

    Voilà j'ai une application avec plusieurs frame dont je désire changer le L&F.
    La lib utilisée est Substance.
    Je voudrais que l'utilisateur puisse changer le l&f quand il le souhaite, je place donc ce changement dans un bouton par exemple:

    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
     
     
    SkPk.addActionListener(new ActionListener(){
     
    	public void actionPerformed(ActionEvent evenement){
     
     
    		try{
     
    			SubstanceLookAndFeel.setCurrentTheme(new  SubstanceBarbyPinkTheme());
    			SubstanceLookAndFeel slf = new SubstanceLookAndFeel();
     
    			UIManager.setLookAndFeel(slf);
     
    		}
    		catch(UnsupportedLookAndFeelException e){
     
    				System.out.println("err");
    		}
     
     
     
     
    	}
    });
    Toute les frames du soft change de l&f sauf la principale(celle où il y a le bouton), je ne comprend pas pourquoi...

    Merci d'avance.
    Pourquoi ca marche jamais?Vive le café!

  2. #2
    Expert éminent sénior
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Points : 12 977
    Points
    12 977
    Par défaut
    Que donnerait un petit SwingUtilities.updateComponentTreeUI(java.awt.Component) appliqué avec ta JFrame principale en paramètre?
    Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.

  3. #3
    Expert éminent sénior
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Points : 23 190
    Points
    23 190
    Billets dans le blog
    1
    Par défaut
    Salut,


    Pris en flagrant délit de non lecture de la FAQ

    Comment changer le Look & Feel de mon aplication ?



    Il faut utiliser la méthode SwingUtilities.updateComponentTreeUI() pour forcer la mise à jours des composants qui sont déjà affichés... sinon cela peut être complétement aléatoire...

    Donc ton cas comme tu as plusieurs fenêtres, ceci devrait marché :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
            for (Frame frame : Frame.getFrames()) {
                SwingUtilities.updateComponentTreeUI(frame);
            }
    a++


    [edit] Oups ! grillé

  4. #4
    Expert confirmé
    Avatar de le y@m's
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2005
    Messages
    2 636
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Février 2005
    Messages : 2 636
    Points : 5 943
    Points
    5 943
    Par défaut
    En plus c'est dans la FAQ : Comment changer le Look & Feel de mon aplication ?

    [edit]arf, double grilled [/edit]
    Je ne répondrai à aucune question technique par MP.

    Pensez aux Tutoriels et aux FAQs avant de poster (pour le java il y a aussi JavaSearch), n'oubliez pas non plus la fonction Rechercher.
    Enfin, quand une solution a été trouvée à votre problème
    pensez au tag

    Cours Dvp : http://ydisanto.developpez.com
    Blog : http://yann-disanto.blogspot.com/
    Page perso : http://yann-disanto.fr

  5. #5
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    Non j'ai fait çà, je lis la FAQ

    C'est parceque quand je fais ceci, ca me chamboule mon GridBagLayout mais vraiment "chamboulé" le grid, les panel dans tout les sens, redimenssionnés, etc...

    Biensûr tout ceci dans la frame principale...sinon les autre c'est nickel.

    J'espère que quelqu'un sait comment résoudre ceci...

    Je suis un FAQueur, je recherche toujours avant dans la FAQ puis google.

    PS: Si la réponse est dans la FAQ, je vais me faire incendier là
    Pourquoi ca marche jamais?Vive le café!

  6. #6
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    Je précise que si je met le lnf au lancement de l'application(donc pas dans un Action), ca fonctionne trés bien.
    Pourquoi ca marche jamais?Vive le café!

  7. #7
    Gfx
    Gfx est déconnecté
    Expert éminent
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Points : 8 178
    Points
    8 178
    Par défaut
    Au passage, evite d'utiliser Substance. Il y a de bonnes idees dedans mais cela reste quand meme le look and feel Swing le plus laid que j'ai pu rencontrer
    Romain Guy
    Android - Mon livre - Mon blog

  8. #8
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    Citation Envoyé par Gfx
    Au passage, evite d'utiliser Substance. Il y a de bonnes idees dedans mais cela reste quand meme le look and feel Swing le plus laid que j'ai pu rencontrer
    tu parle de ce substance -> substance.dev.java.net ?

    il est super parametrable et ya quand meme des theme joli (Aqua-Crosshatch est beau je trouve).

  9. #9
    Gfx
    Gfx est déconnecté
    Expert éminent
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Points : 8 178
    Points
    8 178
    Par défaut
    Je parle de lui et je maintiens que c'est une insulte visuelle.
    Romain Guy
    Android - Mon livre - Mon blog

  10. #10
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    c'est vrai qui ya des truc horrible
    je dis pas le contraire

    mais je trouve certain theme ca va

  11. #11
    Gfx
    Gfx est déconnecté
    Expert éminent
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Points : 8 178
    Points
    8 178
    Par défaut
    Regle numero 1 de la creation d'interface graphique : Ne pas faire confiance aux gouts des developpeurs.
    Romain Guy
    Android - Mon livre - Mon blog

  12. #12
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    100% d'acord avec toi sur ca!!

    jaune, gris, noir, un peu de bleu et du rose en melangeant dans un gradien et hop ca fait un joli fond pour un panel.
    j'ai aussi vu de ces choses, j'en ris mais bon c'est pas forcement drole

  13. #13
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    Je trouve également certain thème trés bien, en tout cas j'ai demandé pas mal de conseil à des non-développeurs pour voir ce qu'ils en pensaient

    Mais sinon pour mon histoire de gridbag, personne n'à d'idée?car je n'aimerais pas vous montrer les code, il doit y avoir 7/8 panel dans un gridbag et ces panel sont eux-même des gridbag...

    Et ca m'embeterai de dire à l'utilisateur de redémarrer le soft pour que ca fonctionne...

    PS : Si tu connais quelques beau L&F, je suis preneur, même si je dois te faire confiance au niveau du goût du l&f
    Pourquoi ca marche jamais?Vive le café!

  14. #14
    Gfx
    Gfx est déconnecté
    Expert éminent
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Points : 8 178
    Points
    8 178
    Par défaut
    Si tu veux des jolis look and feel, de qualite professionnelle, essaye JGoogies Looks, Alloy d'Incors, Synthetica ou ceux de JIDE.
    Romain Guy
    Android - Mon livre - Mon blog

  15. #15
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    Bon pour vous faire voir mon problème, je vais essayer de vous faire 2 screens "Avant"/"Après", et ne me dit pas que c'est horrible Gfx!

    Avant:
    Pièce jointe 3060

    Apres...:
    Pièce jointe 3061

    Donc là c'est un petit gridBag et ca se voit assez bien quand même, alors imaginez vous avec 7/8 panel ce que ca donne...
    Pourquoi ca marche jamais?Vive le café!

  16. #16
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    tu peut afficher le code de ce panel?
    t'es sur que t'a pas un probleme dans tes weightx?

  17. #17
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    Tu désires quel Gridbag? celui qui permet de creer les Panel ou celui qui permet de creer les objets à l'interieur des JPanel?
    Ou les 2?
    Je te demande çà car le code est un peu long.
    Pourquoi ca marche jamais?Vive le café!

  18. #18
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    si tu peut mettre le code des 3 panels [Code barre, Description, Modifications] avec les containte quand tu les ajoute au parent...

    si tu veut, tu peut tout mettre le code. ca sera plus facile a tester dans les meme condition que toi.

    tu as pas utiliser de pading j'espere? je deteste ca!!

  19. #19
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    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
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
     
     
    import javax.swing.*;
    import java.sql.*;
     
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.DocumentListener;
    import javax.swing.event.DocumentEvent;
    import java.math.BigDecimal;
     
    import org.jdesktop.swingx.*;
    import org.jdesktop.swingx.decorator.*;
    import org.jdesktop.swingx.JXTitledPanel;
    import org.jdesktop.swingx.border.DropShadowBorder;
    import javax.swing.border.TitledBorder;
    import org.jvnet.substance.theme.*;
    import org.jvnet.substance.SubstanceLookAndFeel;
     
     
    class AchatMarch extends JFrame implements DocumentListener{
     
     
     
    	//les 2 pans
    	JXPanel xpan1;
    	JXPanel xpan2;
    	JXPanel xpan3;
     
    	JXTitledPanel pan1;
    	JXTitledPanel pan2;
    	JXTitledPanel pan3;
     
     
    	private int x[]   = {0,0,1};
    	private int y[]   = {0,1,0};
    	private int larg[]= {1,1,1};
    	private int haut[]= {1,1,2};
    	private int px[]  = {10,10,20};
    	private int py[]  = {10,40,50};
     
     
    	//pan1
    	private int x1[]   = {0,1};
    	private int y1[]   = {0,0};
    	private int larg1[]= {1,1};
    	private int haut1[]= {1,1};
    	private int px1[]  = {50,20};
    	private int py1[]  = {10,10};
     
     
    	JLabel code ;
    	JTextField codef;
     
     
     
     
     
    	//pan2
    	JLabel inf_rel;
    	JLabel nom;
    	JLabel cons;
    	JLabel qttn;
    	JLabel qtto;
     
    	JTextField jnom;
    	JTextField jcons;
    	JTextField jqttn;
    	JTextField jqtto;
     
     
     
     
     
     
    	private int x2[]   = {0,0,0,0,0,1,1,1,1};
    	private int y2[]   = {0,1,2,3,4,1,2,3,4};
    	private int larg2[]= {2,1,1,1,1,1,1,1,1};
    	private int haut2[]= {1,1,1,1,1,1,1,1,1};
    	private int px2[]  = {20,10,10,10,10,10,10,10,10};
    	private int py2[]  = {10,10,10,10,10,10,10,10,10};
     
     
     
    	//pan 3
    	//pan fourn bas
    	JXPanel pan_fourn;
    	String[][] inf_fourn;
     
    	JLabel fourn;
    	JLabel quant;
    	JLabel neuf;
    	JLabel occas;
    	JLabel prxv;
    	JLabel euro;
     
    	JComboBox jfourn;
    	String[] jcfourn;
     
    	JTextField jquant;
    	JCheckBox jneuf;
    	JCheckBox joccas;
    	JTextField jprxv;
     
    	private int x3[]   = {0,0,0,0,0,0,1,1,1,1,1,0};
    	private int y3[]   = {0,1,2,3,4,5,0,1,2,3,4,6};
    	private int larg3[]= {1,1,1,1,1,2,1,1,1,1,1,2};
    	private int haut3[]= {1,1,1,1,1,1,1,1,1,1,1,1};
    	private int px3[]  = {10,10,10,10,10,20,10,10,10,10,10,20};
    	private int py3[]  = {10,10,10,10,10,40,10,10,10,10,10,10};
     
     
     
     
     
     
     
     
     
     
     
     
    	//pan fourn
    	JLabel nom_fourn;
    	JLabel tel_fourn;
    	JLabel em_fourn;
     
    	JLabel jnom_fourn;
    	JLabel jtel_fourn;
    	JLabel jem_fourn;
     
    	JButton envoi_em;
    	JButton voir_fourn;
     
    	private int x7[]   = { 0,0,0,1,1,1,2,2};
    	private int y7[]   = { 0,1,2,0,1,2,2,0};
    	private int larg7[]= { 1,1,1,2,2,1,1,1};
    	private int haut7[]= { 1,1,1,1,1,1,1,1};
    	private int px7[]  = { 10,10,10,15,15,10,5,5};
    	private int py7[]  = { 10,10,10,10,10,10,10,10};
     
     
     
    	int cara = 0;
    	String f = null;
    	JLabel ajou;
    	JLabel dans;
    	JTextField jajou;
    	JTextField jdans;
    	String getCode=null;
    	String[][] Don_Code;
    	String lab_id=null;
    	String lab_inf=null;
     
    	public AchatMarch(String titre,boolean bool){
     
    		super(titre);
     
    		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
     
    		GridBagLayout layout = new GridBagLayout();
    		getContentPane().setLayout(layout);
    		final GridBagConstraints c = new GridBagConstraints();
                    c.fill = c.BOTH ;
     
                    final Insets in = new Insets(0,10,0,0);
       		final Insets in2 = new Insets(0,0,0,0);
       		final Insets in3 = new Insets(0,20,0,0);
     
       		final Font fo1 = new Font("Tahoma", Font.BOLD, 12);
     
       		codef = new JTextField();
    		codef.getDocument().addDocumentListener(this);
     
     
    		//les 2 pan
    		pan1 = new JXTitledPanel("Code barrre");
    		pan1.setBorder(new DropShadowBorder());
    		pan2 = new JXTitledPanel("Description");
    		pan2.setBorder(new DropShadowBorder());
    		pan3 = new JXTitledPanel("Modifications");
    		pan3.setBorder(new DropShadowBorder());
     
    		xpan1 = new JXPanel();
    		xpan2 = new JXPanel();
    		xpan3 = new JXPanel();
     
    		pan1.add(xpan1);
    		pan2.add(xpan2);
    		pan3.add(xpan3);
     
    		xpan1.setLayout(new GridBagLayout());
    		xpan2.setLayout(new GridBagLayout());
    		xpan3.setLayout(new GridBagLayout());
     
    		ret_nbl();
     
    		for (int i=0; i<x.length; i++){
     
    		     c.gridx=x[i]; c.gridy=y[i];
    		     c.gridwidth=larg[i]; c.gridheight=haut[i];
    		     c.weightx=px[i]; c.weighty=py[i];
     
    		     switch(i){
     
     
    			    case 0: getContentPane().add( pan1, c );;break;
    			    case 1: getContentPane().add( pan2, c ); break;
    				case 2: getContentPane().add( pan3, c ); break;
     
     
    		     }
          	}
     
     
     
    	//	this.getRootPane().setDefaultButton(val);
     
     
     
    		//pan1
    		code = new JLabel("Code Barre:");
    		code.setFont(fo1);
     
     
    		codef.setPreferredSize(new Dimension(120,20));
     
    		for (int i=0; i<x1.length; i++){
     
    		     c.gridx=x1[i]; c.gridy=y1[i];
    		     c.gridwidth=larg1[i]; c.gridheight=haut1[i];
    		     c.weightx=px1[i]; c.weighty=py1[i];
    		     c.insets=in;
    		     switch(i){
     
     
    			     case 0: xpan1.add( code, c );c.fill=c.NONE;c.insets=in2;break;
    			     case 1: xpan1.add( codef, c );c.fill=c.BOTH; break;
     
     
     
    		     }
          	}
     
     
     
          	        //pan2
          	        inf_rel=new JLabel("Informations relatives à l'article");
          	        lab_inf="Informations relatives à l'article";
          	        inf_rel.setFont(fo1);
    		nom=new JLabel("Nom:");
    		cons=new JLabel("Console:");
    		qttn=new JLabel("Quantité Neuf:");
    		qtto=new JLabel("Quantite Occasion:");
     
    		jnom = new JTextField();
    		jnom.setEnabled(false);
    		jcons = new JTextField();
    		jcons.setEnabled(false);
    		jqttn = new JTextField();
    		jqttn.setEnabled(false);
    		jqtto = new JTextField();
    	        jqtto.setEnabled(false);
     
    	        jnom.setPreferredSize(new Dimension(120,20));
    	        jcons.setPreferredSize(new Dimension(120,20));
    	        jqttn.setPreferredSize(new Dimension(120,20));
    	        jqtto.setPreferredSize(new Dimension(120,20));
     
     
          	        for (int i=0; i<x2.length; i++){
     
    		     c.gridx=x2[i]; c.gridy=y2[i];
    		     c.gridwidth=larg2[i]; c.gridheight=haut2[i];
    		     c.weightx=px2[i]; c.weighty=py2[i];
    		     c.insets=in;
    		     switch(i){
     
     
    			     case 0: xpan2.add(inf_rel , c );break;
    			     case 1: xpan2.add( nom, c );break;
    			     case 2: xpan2.add( cons, c );break;
    			     case 3: xpan2.add( qttn, c );break;
    			     case 4: xpan2.add( qtto, c );c.insets=in2;c.fill=c.NONE;break;
    			     case 5: xpan2.add( jnom, c );break;
    			     case 6: xpan2.add( jcons, c );break;
    			     case 7: xpan2.add( jqttn, c );break;
    			     case 8: xpan2.add( jqtto, c );c.fill=c.BOTH;break;
     
     
     
    		     }
          	}
     
     
     
     
     
          	//pan3
          	fourn = new JLabel("Fournisseur:");
    		quant = new JLabel("Quantité:");
    		neuf = new JLabel("Neuf");
    		occas = new JLabel("Occasion");
    		prxv = new JLabel("Prix de vente:");
    		euro = new JLabel("Euro");
     
    		int nbl = ret_nbl();
    		inf_fourn=ret_inf_fourn(nbl);
     
    		jcfourn = new String[nbl];
    	//	System.out.println(inf_fourn[0][0]);
     
    		for(int a=0;a<nbl;a++){
     
    			jcfourn[a]=inf_fourn[a][0];
     
    		}
     
    		jfourn = new JComboBox(jcfourn);
    		jquant = new JTextField();
    		jneuf= new JCheckBox();
    		joccas= new JCheckBox();
    		jprxv = new JTextField();
    		jprxv.setEnabled(bool);
     
          	JButton val = new JButton("Valider");
     
          	jfourn.setPreferredSize(new Dimension(120,20));
          	jquant.setPreferredSize(new Dimension(30,20));
          	jneuf.setPreferredSize(new Dimension(20,20));
          	joccas.setPreferredSize(new Dimension(20,20));
          	jprxv.setPreferredSize(new Dimension(40,20));
          	val.setPreferredSize(new Dimension(100,20));
     
          	pan_fourn = new JXPanel(new GridBagLayout());
          	pan_fourn.setBorder(new TitledBorder(" Fournisseur "));
     
          	for (int i=0; i<x3.length; i++){
     
    		     c.gridx=x3[i]; c.gridy=y3[i];
    		     c.gridwidth=larg3[i]; c.gridheight=haut3[i];
    		     c.weightx=px3[i]; c.weighty=py3[i];
     
     
    		     switch(i){
     
     
    			     case 0: xpan3.add(fourn , c );break;
    			     case 1: xpan3.add(quant, c );break;
    			     case 2: xpan3.add(neuf, c );break;
    			     case 3: xpan3.add(occas, c );break;
    			     case 4: xpan3.add( prxv, c );break;
    			     case 5: xpan3.add( pan_fourn, c );c.fill=c.NONE;break;
    			     case 6: xpan3.add( jfourn, c );break;
    			     case 7: xpan3.add( jquant, c );break;
    			     case 8: xpan3.add( jneuf, c );break;
    			     case 9: xpan3.add( joccas, c );break;
    			     case 10: xpan3.add( jprxv, c );break;
    			     case 11: xpan3.add( val, c );c.fill=c.BOTH;break;
     
     
     
    		     }
          	}
     
     
     
     
          	       //pan fourn
     
          	        nom_fourn = new JLabel("Nom:");
    		tel_fourn = new JLabel("Tel. Comm.:");
    		em_fourn = new JLabel("Email Comm.:");
     
    		jnom_fourn = new JLabel();
    		jtel_fourn = new JLabel();
    		jem_fourn = new JLabel();
     
    		envoi_em = new JButton(new ImageIcon("icones soft/email.png"));
    		voir_fourn = new JButton(new ImageIcon("icones soft/actions/gtk-find.png"));
     
    		ImageIcon image_ico5g = new ImageIcon("icones soft/email.gif");
     
    		envoi_em.setToolTipText("Envoyer un E-mail");
    	 	envoi_em.setRolloverIcon(image_ico5g);
     
     
    	 	voir_fourn.setToolTipText("Afficher le fournisseur");
     
    		envoi_em.setPreferredSize(new Dimension(35,35));
    		voir_fourn.setPreferredSize(new Dimension(35,35));
     
          	for (int i=0; i<x7.length; i++){
     
    		     c.gridx=x7[i]; c.gridy=y7[i];
    		     c.gridwidth=larg7[i]; c.gridheight=haut7[i];
    		     c.weightx=px7[i]; c.weighty=py7[i];
     
    		     c.insets=in;
    		     switch(i){
     
     
    			     case 0: pan_fourn.add(nom_fourn , c );break;
    			     case 1: pan_fourn.add(tel_fourn, c );break;
    			     case 2: pan_fourn.add(em_fourn, c );c.insets=in2;break;
    			     case 3: pan_fourn.add(jnom_fourn, c );break;
    			     case 4: pan_fourn.add(jtel_fourn, c );break;
    			     case 5: pan_fourn.add(jem_fourn, c );c.fill=c.NONE;break;
    			     case 6: pan_fourn.add(envoi_em, c );break;
    			     case 7: pan_fourn.add(voir_fourn, c );c.fill=c.BOTH;break;
     
     
     
     
    		     }
          	}
     
     
     
          	jneuf.setSelected(true);
    	setBounds(0,0,600,400);
     
    	setVisible(true);
    }
    Je t'ai retiré les ActionListener et les méthodes du DocumentListener sinon on s'en sort plus

    Encore merci.

    /edit: rofl désolé pour l'indentation...
    /edit : j'ai rajouté le petit bout qui manquait
    Pourquoi ca marche jamais?Vive le café!

  20. #20
    Membre averti Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Points : 409
    Points
    409
    Par défaut
    J'ai oublié l'actionlistenr du bouton pour changer le l&f:
    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
     
     
    val.addActionListener(new ActionListener(){
     
    			public void actionPerformed(ActionEvent evenement){
     
     
    			        try{
     
    					SubstanceLookAndFeel.setCurrentTheme(new  SubstanceBarbyPinkTheme());
    					SubstanceLookAndFeel slf = new SubstanceLookAndFeel();
     
    					UIManager.setLookAndFeel(slf);
     
    					for (Frame frame : Frame.getFrames()) {
                			             SwingUtilities.updateComponentTreeUI(frame);
            			         }
     
     
    				}
    				catch(UnsupportedLookAndFeelException e){
     
    						System.out.println("err");
    				}
    		}
    });
    Pourquoi ca marche jamais?Vive le café!

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 4 1234 DernièreDernière

Discussions similaires

  1. Programmer encore en VB 6 c'est pas bien ? Pourquoi ?
    Par Nektanebos dans le forum Débats sur le développement - Le Best Of
    Réponses: 85
    Dernier message: 10/03/2009, 14h43
  2. TEdit (encore)
    Par dj.motte dans le forum C++Builder
    Réponses: 5
    Dernier message: 23/12/2002, 19h02
  3. TPalette (encore)
    Par Flipper dans le forum Langage
    Réponses: 3
    Dernier message: 28/11/2002, 23h45

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