Exemplo n.º 1
0
 /**
  * See readObject() and writeObject() in JComponent for more information about serialization in
  * Swing.
  */
 private void writeObject(ObjectOutputStream s) throws IOException {
   s.defaultWriteObject();
   if (getUIClassID().equals(uiClassID)) {
     byte count = JComponent.getWriteObjCounter(this);
     JComponent.setWriteObjCounter(this, --count);
     if (count == 0 && ui != null) {
       ui.installUI(this);
     }
   }
 }
Exemplo n.º 2
0
  ////////////
  // Serialization support.
  ////////////
  private void writeObject(ObjectOutputStream s) throws IOException {
    Vector<Object> values = new Vector<Object>();

    s.defaultWriteObject();
    // Save the invoker, if its Serializable.
    if (invoker != null && invoker instanceof Serializable) {
      values.addElement("invoker");
      values.addElement(invoker);
    }
    // Save the popup, if its Serializable.
    if (popup != null && popup instanceof Serializable) {
      values.addElement("popup");
      values.addElement(popup);
    }
    s.writeObject(values);

    if (getUIClassID().equals(uiClassID)) {
      byte count = JComponent.getWriteObjCounter(this);
      JComponent.setWriteObjCounter(this, --count);
      if (count == 0 && ui != null) {
        ui.installUI(this);
      }
    }
  }