src/share/classes/java/awt/CardLayout.java

Print this page




 543                         break;
 544                     }
 545                 }
 546                 next.setVisible(true);
 547                 parent.validate();
 548             }
 549         }
 550     }
 551 
 552     /**
 553      * Returns a string representation of the state of this card layout.
 554      * @return    a string representation of this card layout.
 555      */
 556     public String toString() {
 557         return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
 558     }
 559 
 560     /**
 561      * Reads serializable fields from stream.
 562      */

 563     private void readObject(ObjectInputStream s)
 564         throws ClassNotFoundException, IOException
 565     {
 566         ObjectInputStream.GetField f = s.readFields();
 567 
 568         hgap = f.get("hgap", 0);
 569         vgap = f.get("vgap", 0);
 570 
 571         if (f.defaulted("vector")) {
 572             //  pre-1.4 stream
 573             Hashtable<String, Component> tab = (Hashtable)f.get("tab", null);
 574             vector = new Vector<>();
 575             if (tab != null && !tab.isEmpty()) {
 576                 for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) {
 577                     String key = e.nextElement();
 578                     Component comp = tab.get(key);
 579                     vector.add(new Card(key, comp));
 580                     if (comp.isVisible()) {
 581                         currentCard = vector.size() - 1;
 582                     }




 543                         break;
 544                     }
 545                 }
 546                 next.setVisible(true);
 547                 parent.validate();
 548             }
 549         }
 550     }
 551 
 552     /**
 553      * Returns a string representation of the state of this card layout.
 554      * @return    a string representation of this card layout.
 555      */
 556     public String toString() {
 557         return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
 558     }
 559 
 560     /**
 561      * Reads serializable fields from stream.
 562      */
 563     @SuppressWarnings("unchecked")
 564     private void readObject(ObjectInputStream s)
 565         throws ClassNotFoundException, IOException
 566     {
 567         ObjectInputStream.GetField f = s.readFields();
 568 
 569         hgap = f.get("hgap", 0);
 570         vgap = f.get("vgap", 0);
 571 
 572         if (f.defaulted("vector")) {
 573             //  pre-1.4 stream
 574             Hashtable<String, Component> tab = (Hashtable)f.get("tab", null);
 575             vector = new Vector<>();
 576             if (tab != null && !tab.isEmpty()) {
 577                 for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) {
 578                     String key = e.nextElement();
 579                     Component comp = tab.get(key);
 580                     vector.add(new Card(key, comp));
 581                     if (comp.isVisible()) {
 582                         currentCard = vector.size() - 1;
 583                     }