Testes sur les jpanels affiché dans un cardlayout

bassoumbassoum Messages postés 18 Date d'inscription jeudi 27 mars 2008 Statut Membre Dernière intervention 16 mars 2009 - 20 févr. 2009 à 17:43
bassoumbassoum Messages postés 18 Date d'inscription jeudi 27 mars 2008 Statut Membre Dernière intervention 16 mars 2009 - 22 févr. 2009 à 16:28
salut,
pouvez vous m'aider?

j'ai fais un programme avec cardlayout qui n'affiche q'un seul panel a
la fois et je veux faire des testes sur ce panel affiché par exemple si
le pannneau1 affiché faire tel et tel traitement mais j'arrive pas a
faire ça et je trouve pas les moyens a faire ça alors comment connaitre
que le panneau1 par exemple est affiché et quels sont les
fonctionnalité necessaire

et merci d'avance.

7 réponses

uhrand Messages postés 491 Date d'inscription samedi 20 mai 2006 Statut Membre Dernière intervention 15 juillet 2012 9
21 févr. 2009 à 00:16
L'extension "RXCardLayout" (par Rob Camick) contient la nouvelle méthode "getCurrentCard":

if (cardLayout.getCurrentCard() == panneau1){
    //traitement concernant panneau1
}

http://tips4java.wordpress.com/2008/10/31/card-layout-focus/
0
uhrand Messages postés 491 Date d'inscription samedi 20 mai 2006 Statut Membre Dernière intervention 15 juillet 2012 9
21 févr. 2009 à 00:17
0
bassoumbassoum Messages postés 18 Date d'inscription jeudi 27 mars 2008 Statut Membre Dernière intervention 16 mars 2009
21 févr. 2009 à 21:54
salut,
j'ai essayer avec cette classe mais je ne trouve rien la methode getcurrentcard ne retourne pas le panel si c possible vous voulez voir le code c'est ça possible?
0
uhrand Messages postés 491 Date d'inscription samedi 20 mai 2006 Statut Membre Dernière intervention 15 juillet 2012 9
22 févr. 2009 à 00:40
Peus-tu nous montrer un peu de code pour savoir ce que tu veus faire exactement?
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
bassoumbassoum Messages postés 18 Date d'inscription jeudi 27 mars 2008 Statut Membre Dernière intervention 16 mars 2009
22 févr. 2009 à 01:18
une petite resumé sur le code:
je veux que lorsque je passe de panl1 au panel2 les jlabel(entrer url et generer rapport deviennent desactivée qui sont activé sur le frame)
l'ecriture en rouge est la plus interressante mais si vous besoin d'essayer le code c'est tout est complet ce code
la classe principale qui contient le main est:

import javax.swing.*;
import java.awt.*;

    import java.awt.event.*;

public class Source extends javax.swing.JFrame implements ActionListener {

  JMenuItem Anglais;
    JMenu aide;
JMenuItem apropos;
JMenuItem arabe;
  JMenuItem enregistrer;
  JLabel entrerurl;
JLabel evaluer;
 JMenu fichier;
JMenuItem francais;
 JLabel genererrapport;
 JPanel grandpanneau;
    JMenuItem guideaccess;
  JMenuItem guidewcag;
JButton jButton1;
JButton jButton2;
JMenu jMenu2;
    JMenuBar jMenuBar1;
    JMenuItem jMenuItem1;
    JSeparator jSeparator1;
   JSeparator jSeparator2;
JSeparator jSeparator3;
  JSeparator jSeparator4;
  JSeparator jSeparator5;
    JSeparator jSeparator6;
   JSeparator jSeparator7;
  JSeparator jSeparator8;
JMenu langue;
JMenuItem ouvrir;
 JPanel panneaubouttons;
 JPanel panneaudemenu;
JPanel panneauvariable;
  JMenuItem variable;

        private RXCardLayout pile;
    public Source() {
     setTitle("evaluation") ;
pile = new RXCardLayout();
   
        entrerurl = new JLabel();
        evaluer = new JLabel();
        genererrapport = new JLabel();
    grandpanneau = new JPanel();

        panneaudemenu = new JPanel();
        panneauvariable = new JPanel();
       
        jSeparator8 = new JSeparator();
        panneaubouttons = new JPanel();
        jButton1 = new JButton();
        jButton2 = new JButton();
        jMenuBar1 = new JMenuBar();
        fichier = new JMenu();
        jMenuItem1 = new JMenuItem();
        jSeparator1 = new JSeparator();
        ouvrir = new JMenuItem();
        jSeparator2 = new JSeparator();
        enregistrer = new JMenuItem();
        jSeparator3 = new JSeparator();
        variable = new JMenuItem();
        jMenu2 = new JMenu();
        langue = new JMenu();
        arabe = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JSeparator();
        francais = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JSeparator();
        Anglais = new javax.swing.JMenuItem();
        aide = new javax.swing.JMenu();
        apropos = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JSeparator();
        guideaccess = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JSeparator();
        guidewcag = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        panneaudemenu.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        entrerurl.setText("Entrer URL");

        evaluer.setText("Evaluer");

        genererrapport.setText("Generer Rapport");

        javax.swing.GroupLayout panneaudemenuLayout = new javax.swing.GroupLayout(panneaudemenu);
        panneaudemenu.setLayout(panneaudemenuLayout);
        panneaudemenuLayout.setHorizontalGroup(
            panneaudemenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panneaudemenuLayout.createSequentialGroup()
                .addGroup(panneaudemenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(entrerurl)
                    .addComponent(evaluer)
                    .addComponent(genererrapport))
                .addContainerGap(18, Short.MAX_VALUE))
        );
        panneaudemenuLayout.setVerticalGroup(
            panneaudemenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panneaudemenuLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(entrerurl)
                .addGap(26, 26, 26)
                .addComponent(evaluer)
                .addGap(31, 31, 31)
                .addComponent(genererrapport)
                .addContainerGap(177, Short.MAX_VALUE))
        );

        panneauvariable.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panneauvariableLayout = new javax.swing.GroupLayout(panneauvariable);
        panneauvariable.setLayout(panneauvariableLayout);
        panneauvariableLayout.setHorizontalGroup(
            panneauvariableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 291, Short.MAX_VALUE)
        );
        panneauvariableLayout.setVerticalGroup(
            panneauvariableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 250, Short.MAX_VALUE)
        );

        jSeparator8.setOrientation(javax.swing.SwingConstants.VERTICAL);

        jButton1.setText("suivant");
         jButton1.addActionListener(this);

        jButton2.setText("precedent");
        jButton2.addActionListener(this);
        javax.swing.GroupLayout panneaubouttonsLayout = new javax.swing.GroupLayout(panneaubouttons);
        panneaubouttons.setLayout(panneaubouttonsLayout);
        panneaubouttonsLayout.setHorizontalGroup(
            panneaubouttonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panneaubouttonsLayout.createSequentialGroup()
                .addContainerGap(127, Short.MAX_VALUE)
                .addComponent(jButton2)
                .addGap(18, 18, 18)
                .addComponent(jButton1))
        );
        panneaubouttonsLayout.setVerticalGroup(
            panneaubouttonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panneaubouttonsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panneaubouttonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout grandpanneauLayout = new javax.swing.GroupLayout(grandpanneau);
        grandpanneau.setLayout(grandpanneauLayout);
        grandpanneauLayout.setHorizontalGroup(
            grandpanneauLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(grandpanneauLayout.createSequentialGroup()
                .addComponent(panneaudemenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator8, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(grandpanneauLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(panneaubouttons, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panneauvariable, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        grandpanneauLayout.setVerticalGroup(
            grandpanneauLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator8, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
            .addComponent(panneaudemenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(grandpanneauLayout.createSequentialGroup()
                .addComponent(panneauvariable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panneaubouttons, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        fichier.setText("Fichier");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem1.setText("Nouveau");
        fichier.add(jMenuItem1);
        fichier.add(jSeparator1);

        ouvrir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK));
        ouvrir.setText("Ouvrir");
        fichier.add(ouvrir);
        fichier.add(jSeparator2);

        enregistrer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK));
        enregistrer.setText("Enregistrer");
        fichier.add(enregistrer);
        fichier.add(jSeparator3);

        variable.setText("Fermer");
        fichier.add(variable);

        jMenuBar1.add(fichier);

        jMenu2.setText("Edition");
        jMenuBar1.add(jMenu2);

        langue.setText("Langue");

        arabe.setText("Arabe");
        langue.add(arabe);
        langue.add(jSeparator4);

        francais.setText("Français");
        langue.add(francais);
        langue.add(jSeparator5);

        Anglais.setText("Anglais");
        langue.add(Anglais);

        jMenuBar1.add(langue);

        aide.setText("Aide");

        apropos.setText("A propos de l'outil");
        aide.add(apropos);
        aide.add(jSeparator6);

        guideaccess.setText("Guide Accessiweb v1.1");
        aide.add(guideaccess);
        aide.add(jSeparator7);

        guidewcag.setText("Guide WCAG v2.0");
        aide.add(guidewcag);

        jMenuBar1.add(aide);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(grandpanneau, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(grandpanneau, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
                 panneauvariable.setLayout(pile);
             Panel1 pan =new Panel1();

     panneauvariable.add(pan,"1");
     Evaluer eval=new Evaluer();
    panneauvariable.add(eval,"2");
if(pile.getCurrentCard()==pan)
{evaluer.setEnabled(false);
 genererrapport.setEnabled(false);
jButton2.setEnabled(false);
}
else if(pile.getCurrentCard()==eval)
{
evaluer.setEnabled(true);
 genererrapport.setEnabled(false);
jButton2.setEnabled(true);
entrerurl.setEnabled(false);
}
    pack();
    }
   

 

 public void actionPerformed(ActionEvent a)
         {

          if(   a.getSource()== jButton1)
          { pile.show(panneauvariable,"2");
       
          
}
          if(   a.getSource()==jButton2)
              pile.show(panneauvariable,"1");
          setTitle("entrer url");
         

         }

  
    public static void main(String args[]) {
     
  java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               new Source().setVisible(true);
            }
        });
          
      
     
    }

}

les calsses des panneau sont:

public class Panel1 extends javax.swing.JPanel {

    /** Creates new form Panel1 */
    public Panel1() {
        initComponents();
    }

                        
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();

        jPanel1.setLayout(new java.awt.CardLayout());

        jLabel1.setText("Entrer URL:");

        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jRadioButton1.setText("Accessiweb v1.1");

        jRadioButton2.setText("WCAG v2.0");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 214, Short.MAX_VALUE)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(186, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRadioButton1)
                .addContainerGap(289, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRadioButton2)
                .addContainerGap(313, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(41, 41, 41)
                .addComponent(jRadioButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 47, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton2)
                .addContainerGap(114, Short.MAX_VALUE))
        );
    }       

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:

    }                                          

               
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration                  

}

l'autres classe est :

public class Evaluer extends javax.swing.JPanel {

   
    public Evaluer() {
        initComponents();
    }

                   
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPane1 = new javax.swing.JTextPane();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextPane2 = new javax.swing.JTextPane();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextPane3 = new javax.swing.JTextPane();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTextPane4 = new javax.swing.JTextPane();

        jScrollPane1.setViewportView(jTextPane1);

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        jScrollPane2.setViewportView(jTextPane2);

        jScrollPane3.setViewportView(jTextPane3);

        jTabbedPane1.addTab("erreurs", jScrollPane3);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane4.setViewportView(jTextArea1);

        jTabbedPane1.addTab("détails", jScrollPane4);

        jScrollPane5.setViewportView(jTextPane4);

        jTabbedPane1.addTab("fichier xml", jScrollPane5);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)
            .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }                 

    // Variables declaration - do not modify                    
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextPane jTextPane1;
    private javax.swing.JTextPane jTextPane2;
    private javax.swing.JTextPane jTextPane3;
    private javax.swing.JTextPane jTextPane4;
    // End of variables declaration                  

}

vraiment je serais reconnaissante si j'ai resolue mon probleme car vraiment j'ai essayer et le prog n'affiche rien
merci d'avance
0
uhrand Messages postés 491 Date d'inscription samedi 20 mai 2006 Statut Membre Dernière intervention 15 juillet 2012 9
22 févr. 2009 à 14:43
import javax.swing.*;
import java.awt.event.*;
public class Source extends javax.swing.JFrame implements ActionListener {
    JMenuItem Anglais;
    JMenu aide;
    JMenuItem apropos;
    JMenuItem arabe;
    JMenuItem enregistrer;
    JLabel entrerurl;
    JLabel evaluer;
    JMenu fichier;
    JMenuItem francais;
    JLabel genererrapport;
    JPanel grandpanneau;
    JMenuItem guideaccess;
    JMenuItem guidewcag;
    JButton jButton1;
    JButton jButton2;
    JMenu jMenu2;
    JMenuBar jMenuBar1;
    JMenuItem jMenuItem1;
    JSeparator jSeparator1;
    JSeparator jSeparator2;
    JSeparator jSeparator3;
    JSeparator jSeparator4;
    JSeparator jSeparator5;
    JSeparator jSeparator6;
    JSeparator jSeparator7;
    JSeparator jSeparator8;
    JMenu langue;
    JMenuItem ouvrir;
    JPanel panneaubouttons;
    JPanel panneaudemenu;
    JPanel panneauvariable;
    JMenuItem variable;
    private RXCardLayout pile;
    private Panel1 pan;
    private Evaluer eval;
    public Source() {
        setTitle("entrer url");
        pile = new RXCardLayout();
        entrerurl = new JLabel();
        evaluer = new JLabel();
        genererrapport = new JLabel();
        grandpanneau = new JPanel();
        panneaudemenu = new JPanel();
        panneauvariable = new JPanel();
        jSeparator8 = new JSeparator();
        panneaubouttons = new JPanel();
        jButton1 = new JButton();
        jButton2 = new JButton();
        jMenuBar1 = new JMenuBar();
        fichier = new JMenu();
        jMenuItem1 = new JMenuItem();
        jSeparator1 = new JSeparator();
        ouvrir = new JMenuItem();
        jSeparator2 = new JSeparator();
        enregistrer = new JMenuItem();
        jSeparator3 = new JSeparator();
        variable = new JMenuItem();
        jMenu2 = new JMenu();
        langue = new JMenu();
        arabe = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JSeparator();
        francais = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JSeparator();
        Anglais = new javax.swing.JMenuItem();
        aide = new javax.swing.JMenu();
        apropos = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JSeparator();
        guideaccess = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JSeparator();
        guidewcag = new javax.swing.JMenuItem();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        panneaudemenu.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        entrerurl.setText("Entrer URL");
        evaluer.setText("Evaluer");
        genererrapport.setText("Generer Rapport");
        javax.swing.GroupLayout panneaudemenuLayout = new javax.swing.GroupLayout(panneaudemenu);
        panneaudemenu.setLayout(panneaudemenuLayout);
        panneaudemenuLayout.setHorizontalGroup(
                panneaudemenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(panneaudemenuLayout.createSequentialGroup().addGroup(panneaudemenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(entrerurl).addComponent(evaluer).addComponent(genererrapport)).addContainerGap(18, Short.MAX_VALUE)));
        panneaudemenuLayout.setVerticalGroup(
                panneaudemenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(panneaudemenuLayout.createSequentialGroup().addGap(25, 25, 25).addComponent(entrerurl).addGap(26, 26, 26).addComponent(evaluer).addGap(31, 31, 31).addComponent(genererrapport).addContainerGap(177, Short.MAX_VALUE)));
        panneauvariable.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        javax.swing.GroupLayout panneauvariableLayout = new javax.swing.GroupLayout(panneauvariable);
        panneauvariable.setLayout(panneauvariableLayout);
        panneauvariableLayout.setHorizontalGroup(
                panneauvariableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 291, Short.MAX_VALUE));
        panneauvariableLayout.setVerticalGroup(
                panneauvariableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 250, Short.MAX_VALUE));
        jSeparator8.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jButton1.setText("suivant");
        jButton1.addActionListener(this);
        jButton2.setText("precedent");
        jButton2.addActionListener(this);
        javax.swing.GroupLayout panneaubouttonsLayout = new javax.swing.GroupLayout(panneaubouttons);
        panneaubouttons.setLayout(panneaubouttonsLayout);
        panneaubouttonsLayout.setHorizontalGroup(
                panneaubouttonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panneaubouttonsLayout.createSequentialGroup().addContainerGap(127, Short.MAX_VALUE).addComponent(jButton2).addGap(18, 18, 18).addComponent(jButton1)));
        panneaubouttonsLayout.setVerticalGroup(
                panneaubouttonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(panneaubouttonsLayout.createSequentialGroup().addContainerGap().addGroup(panneaubouttonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jButton1).addComponent(jButton2)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        javax.swing.GroupLayout grandpanneauLayout = new javax.swing.GroupLayout(grandpanneau);
        grandpanneau.setLayout(grandpanneauLayout);
        grandpanneauLayout.setHorizontalGroup(
                grandpanneauLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(grandpanneauLayout.createSequentialGroup().addComponent(panneaudemenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jSeparator8, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(grandpanneauLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false).addComponent(panneaubouttons, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(panneauvariable, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
        grandpanneauLayout.setVerticalGroup(
                grandpanneauLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jSeparator8, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE).addComponent(panneaudemenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(grandpanneauLayout.createSequentialGroup().addComponent(panneauvariable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(panneaubouttons, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        fichier.setText("Fichier");
        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem1.setText("Nouveau");
        fichier.add(jMenuItem1);
        fichier.add(jSeparator1);
        ouvrir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK));
        ouvrir.setText("Ouvrir");
        fichier.add(ouvrir);
        fichier.add(jSeparator2);
        enregistrer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK));
        enregistrer.setText("Enregistrer");
        fichier.add(enregistrer);
        fichier.add(jSeparator3);
        variable.setText("Fermer");
        fichier.add(variable);
        jMenuBar1.add(fichier);
        jMenu2.setText("Edition");
        jMenuBar1.add(jMenu2);
        langue.setText("Langue");
        arabe.setText("Arabe");
        langue.add(arabe);
        langue.add(jSeparator4);
        francais.setText("Français");
        langue.add(francais);
        langue.add(jSeparator5);
        Anglais.setText("Anglais");
        langue.add(Anglais);
        jMenuBar1.add(langue);
        aide.setText("Aide");
        apropos.setText("A propos de l'outil");
        aide.add(apropos);
        aide.add(jSeparator6);
        guideaccess.setText("Guide Accessiweb v1.1");
        aide.add(guideaccess);
        aide.add(jSeparator7);
        guidewcag.setText("Guide WCAG v2.0");
        aide.add(guidewcag);
        jMenuBar1.add(aide);
        setJMenuBar(jMenuBar1);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(grandpanneau, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(grandpanneau, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        panneauvariable.setLayout(pile);
        pan = new Panel1();
        panneauvariable.add(pan, "1");
        eval = new Evaluer();
        panneauvariable.add(eval, "2");
        JPanel generer = new JPanel();
        panneauvariable.add(generer, "3");
        pack();
        
        entrerurl.setEnabled(true);
        evaluer.setEnabled(false);
        genererrapport.setEnabled(false);
        jButton2.setEnabled(false);
    }
    public void actionPerformed(ActionEvent a) {
        if (a.getSource() == jButton1) {
            pile.next(panneauvariable);
        }
        if (a.getSource() == jButton2) {
            pile.previous(panneauvariable);
        }
        Runnable check = new Runnable() {
            public void run() {
                JComponent current = pile.getCurrentCard();
                if (current == pan) {
                    setTitle("entrer url");
                    entrerurl.setEnabled(true);
                    evaluer.setEnabled(false);
                    genererrapport.setEnabled(false);
                    jButton2.setEnabled(false);
                    jButton1.setEnabled(true);
                } else if (current == eval) {
                    setTitle("evaluer");
                    entrerurl.setEnabled(false);
                    evaluer.setEnabled(true);
                    genererrapport.setEnabled(false);
                    jButton2.setEnabled(true);
                    jButton1.setEnabled(true);
                }else{
                    setTitle("generer rapport");
                    entrerurl.setEnabled(false);
                    evaluer.setEnabled(false);
                    genererrapport.setEnabled(true);
                    jButton2.setEnabled(true);
                    jButton1.setEnabled(false);
                }
            }
        };
        SwingUtilities.invokeLater(check);
    }
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Source().setVisible(true);
            }
        });
    }
}
0
bassoumbassoum Messages postés 18 Date d'inscription jeudi 27 mars 2008 Statut Membre Dernière intervention 16 mars 2009
22 févr. 2009 à 16:28
merci infiniment merci beaucoup
vraiment je trouve pas les mots pour exprimer
enfin mon probleme est resolue j'essayé a aider tous ce qui a le meme pb
0