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

Print this page

        

*** 64,74 **** /* * This creates a Vector to store associated * pairs of components and their names. * @see java.util.Vector */ ! Vector vector = new Vector(); /* * A pair of Component and String that represents its name. */ class Card implements Serializable { --- 64,74 ---- /* * This creates a Vector to store associated * pairs of components and their names. * @see java.util.Vector */ ! Vector<Card> vector = new Vector<>(); /* * A pair of Component and String that represents its name. */ class Card implements Serializable {
*** 568,581 **** hgap = f.get("hgap", 0); vgap = f.get("vgap", 0); if (f.defaulted("vector")) { // pre-1.4 stream ! Hashtable tab = (Hashtable)f.get("tab", null); ! vector = new Vector(); if (tab != null && !tab.isEmpty()) { ! for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { String key = (String)e.nextElement(); Component comp = (Component)tab.get(key); vector.add(new Card(key, comp)); if (comp.isVisible()) { currentCard = vector.size() - 1; --- 568,581 ---- hgap = f.get("hgap", 0); vgap = f.get("vgap", 0); if (f.defaulted("vector")) { // pre-1.4 stream ! Hashtable<String, Component> tab = (Hashtable)f.get("tab", null); ! vector = new Vector<>(); if (tab != null && !tab.isEmpty()) { ! for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) { String key = (String)e.nextElement(); Component comp = (Component)tab.get(key); vector.add(new Card(key, comp)); if (comp.isVisible()) { currentCard = vector.size() - 1;
*** 592,602 **** * Writes serializable fields to stream. */ private void writeObject(ObjectOutputStream s) throws IOException { ! Hashtable tab = new Hashtable(); int ncomponents = vector.size(); for (int i = 0; i < ncomponents; i++) { Card card = (Card)vector.get(i); tab.put(card.name, card.comp); } --- 592,602 ---- * Writes serializable fields to stream. */ private void writeObject(ObjectOutputStream s) throws IOException { ! Hashtable<String, Component> tab = new Hashtable<>(); int ncomponents = vector.size(); for (int i = 0; i < ncomponents; i++) { Card card = (Card)vector.get(i); tab.put(card.name, card.comp); }