src/share/classes/javax/swing/JOptionPane.java

Print this page




2370             }
2371         }
2372         // Save the inputValue, if its Serializable.
2373         if(inputValue != null && inputValue instanceof Serializable) {
2374             values.addElement("inputValue");
2375             values.addElement(inputValue);
2376         }
2377         // Save the initialSelectionValue, if its Serializable.
2378         if(initialSelectionValue != null &&
2379            initialSelectionValue instanceof Serializable) {
2380             values.addElement("initialSelectionValue");
2381             values.addElement(initialSelectionValue);
2382         }
2383         s.writeObject(values);
2384     }
2385 
2386     private void readObject(ObjectInputStream s)
2387         throws IOException, ClassNotFoundException {
2388         s.defaultReadObject();
2389 
2390         Vector          values = (Vector)s.readObject();
2391         int             indexCounter = 0;
2392         int             maxCounter = values.size();
2393 
2394         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2395            equals("icon")) {
2396             icon = (Icon)values.elementAt(++indexCounter);
2397             indexCounter++;
2398         }
2399         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2400            equals("message")) {
2401             message = values.elementAt(++indexCounter);
2402             indexCounter++;
2403         }
2404         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2405            equals("options")) {
2406             options = (Object[])values.elementAt(++indexCounter);
2407             indexCounter++;
2408         }
2409         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2410            equals("initialValue")) {




2370             }
2371         }
2372         // Save the inputValue, if its Serializable.
2373         if(inputValue != null && inputValue instanceof Serializable) {
2374             values.addElement("inputValue");
2375             values.addElement(inputValue);
2376         }
2377         // Save the initialSelectionValue, if its Serializable.
2378         if(initialSelectionValue != null &&
2379            initialSelectionValue instanceof Serializable) {
2380             values.addElement("initialSelectionValue");
2381             values.addElement(initialSelectionValue);
2382         }
2383         s.writeObject(values);
2384     }
2385 
2386     private void readObject(ObjectInputStream s)
2387         throws IOException, ClassNotFoundException {
2388         s.defaultReadObject();
2389 
2390         Vector<?>       values = (Vector)s.readObject();
2391         int             indexCounter = 0;
2392         int             maxCounter = values.size();
2393 
2394         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2395            equals("icon")) {
2396             icon = (Icon)values.elementAt(++indexCounter);
2397             indexCounter++;
2398         }
2399         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2400            equals("message")) {
2401             message = values.elementAt(++indexCounter);
2402             indexCounter++;
2403         }
2404         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2405            equals("options")) {
2406             options = (Object[])values.elementAt(++indexCounter);
2407             indexCounter++;
2408         }
2409         if(indexCounter < maxCounter && values.elementAt(indexCounter).
2410            equals("initialValue")) {