Exemplo n.º 1
0
 static {
   /* ensure that the necessary native libraries are loaded */
   Toolkit.loadLibraries();
   if (!GraphicsEnvironment.isHeadless()) {
     initIDs();
   }
 }
Exemplo n.º 2
0
 /**
  * Constructs a Checkbox with the specified label, set to the specified state, and in the
  * specified check box group.
  *
  * @param label a string label for this check box, or <code>null</code> for no label.
  * @param state the initial state of this check box.
  * @param group a check box group for this check box, or <code>null</code> for no group.
  * @exception HeadlessException if <code>GraphicsEnvironment.isHeadless</code> returns <code>true
  *     </code>
  * @see j86.java.awt.GraphicsEnvironment#isHeadless
  * @since JDK1.1
  */
 public Checkbox(String label, boolean state, CheckboxGroup group) throws HeadlessException {
   GraphicsEnvironment.checkHeadless();
   this.label = label;
   this.state = state;
   this.group = group;
   if (state && (group != null)) {
     group.setSelectedCheckbox(this);
   }
 }
Exemplo n.º 3
0
  /**
   * Reads the <code>ObjectInputStream</code> and if it isn't <code>null</code> adds a listener to
   * receive item events fired by the <code>Checkbox</code>. Unrecognized keys or values will be
   * ignored.
   *
   * @param s the <code>ObjectInputStream</code> to read
   * @exception HeadlessException if <code>GraphicsEnvironment.isHeadless</code> returns <code>true
   *     </code>
   * @serial
   * @see #removeItemListener(ItemListener)
   * @see #addItemListener(ItemListener)
   * @see j86.java.awt.GraphicsEnvironment#isHeadless
   * @see #writeObject(ObjectOutputStream)
   */
  private void readObject(ObjectInputStream s)
      throws ClassNotFoundException, IOException, HeadlessException {
    GraphicsEnvironment.checkHeadless();
    s.defaultReadObject();

    Object keyOrNull;
    while (null != (keyOrNull = s.readObject())) {
      String key = ((String) keyOrNull).intern();

      if (itemListenerK == key) addItemListener((ItemListener) (s.readObject()));
      else // skip value for unrecognized key
      s.readObject();
    }
  }