title: Using CardLayout with a JTable, and JTable.getSelectedRow() always returns -1
body: <p>I want to use a <code>CardLayout</code> to use several <code>JTable</code> and with that the <code>JTable.getSelectedRow()</code> doesn't work. Here is what I've tried:</p>
  
  <pre><code>public void createWindow() {
          // creation du tableau d'article
  
          this.ajouterLesArticles();
  
          // Contener principal
          main = new JPanel();
          this.setContentPane(main);
          main.setLayout(new BorderLayout());
  
          // Panel du haut
          top = new JPanel();
          title = new JLabel(titlewindow);
          welcome = new JLabel("Bonjour, ");
          top.setLayout(new BoxLayout(top, BoxLayout.LINE_AXIS));
          top.setBackground(Color.decode("#E5E5E5"));
          title.setForeground(Color.decode("#E56302"));
          title.setFont(new Font("Calibri", Font.PLAIN, 20));
          welcome.setFont(new Font("Calibri", Font.PLAIN, 20));
          welcome.setForeground(Color.decode("#E56302"));
  
          // Ajout des composants au panel
          top.add(Box.createRigidArea(new Dimension(50, 100)));
          top.add(title);
          top.add(Box.createHorizontalGlue());
          top.add(welcome);
          top.add(Box.createRigidArea(new Dimension(40, 100)));
  //      top.add(piclabel);
          top.add(Box.createRigidArea(new Dimension(60, 100)));
  
          // Panel de Gauche
          left = new JPanel();
          left.setLayout(new GridLayout(6, 1));
          left.setPreferredSize(new Dimension(150, 0));
          left.setBackground(Color.decode("#E5E5E5"));
          home = new JButton("&lt;-- Accueil");
          btnleft1 = new JButton(labels[0]);
          btnleft2 = new JButton(labels[1]);
          btnleft3 = new JButton(labels[2]);
          btnleft4 = new JButton(labels[3]);
  
          // Listeners des boutons de gauche
  //      btnleft4.addActionListener(new OpenParametres());
          btnleft1.addActionListener(new  changerPanelStock());
          btnleft2.addActionListener(new changerPanelClient());
  //      home.addActionListener(new BackHome());
  
          // Ajout des composants au Panel
          left.add(home);
          left.add(btnleft1);
          left.add(btnleft2);
          left.add(btnleft3);
          left.add(btnleft4);
  
          // Panel central
          center = new JPanel();
          center.setLayout(cl);
          center.setBorder(new EmptyBorder(10, 10, 10, 10));
          center.add(creationPanelStock(), "stock");
          center.add(creationPanelClient(), "client");
          cl.show(center,"stock");
  
          // Ajout des panel au panel principal
                  main.add(top, BorderLayout.NORTH);
                  main.add(left, BorderLayout.WEST);
                  main.add(center, BorderLayout.CENTER);
      }
  
      public JPanel creationPanelStock(){
  
          this.ajouterLesArticles();
  
          line1 = new JPanel();
          line2 = new JPanel();
          line3 = new JPanel();
  
          searchtitle = new JLabel("Rechercher un article : ");
          tfsearch = new JTextField();
          tfsearch.setColumns(22);
          tfsearch.getDocument().addDocumentListener(new Filtre());
          gsearch = new TextPrompt("Entrez un nom ou une référence",tfsearch);
          add = new JButton ("Créer un article...");
          remove = new JButton ("Supprimer...");
          modify = new JButton ("Modifer...");
          modify.setEnabled(false);
          modify.addActionListener(new modifierArticle());
          remove.setEnabled(false);
          remove.addActionListener(new supprimer());
          search = new JButton ("Rechercher");
          listeArticle.setSize(300,100);
          listeArticle.getSelectionModel().addListSelectionListener(new selectionliste());
          listeArticle.setAutoCreateRowSorter(true);
          //liste.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  
  
          //PremiÃ¨re ligne de "center"
          line1.add(add);
          add.addActionListener(new NewArticle());
          line1.add(modify);
          line1.add(remove);
  
          //DeuxiÃ¨me ligne de "center"
          line2.add(searchtitle);
          line2.add(tfsearch);
          line2.add(search);
  
          //troisiÃ¨me ligne de "center"
          JScrollPane js = new JScrollPane(listeArticle);
          js.setPreferredSize(new Dimension(600,120));
          line3.add(js);
  
          panelStock = new JPanel(new GridLayout(3,1,10,10));
          panelStock.add(line1);
          panelStock.add(line2);
          panelStock.add(line3);
  
          return panelStock;
      }
  </code></pre>
  
  <p>I create windows with two panel and each of them has a <code>JTable</code> but I can't selected anything, and this listener doesn't work:</p>
  
  <pre><code>public class selectionliste implements ListSelectionListener{
  
          @Override
          public void valueChanged(ListSelectionEvent e) {
              // TODO Auto-generated method stub
              if (listeArticle.getSelectedRow() &gt; -1) {
                  modify.setEnabled(true);
                  remove.setEnabled(true);
              }else{
                  modify.setEnabled(false);
                  remove.setEnabled(false);
              }
  
          }
  
      }
  </code></pre>