コード例 #1
0
ファイル: Checkbox.java プロジェクト: ronshapiro/j86
 /**
  * Adds the specified item listener to receive item events from this check box. Item events are
  * sent to listeners in response to user input, but not in response to calls to setState(). If l
  * is null, no exception is thrown and no action is performed.
  *
  * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" >AWT Threading Issues</a>
  * for details on AWT's threading model.
  *
  * @param l the item listener
  * @see #removeItemListener
  * @see #getItemListeners
  * @see #setState
  * @see j86.java.awt.event.ItemEvent
  * @see j86.java.awt.event.ItemListener
  * @since JDK1.1
  */
 public synchronized void addItemListener(ItemListener l) {
   if (l == null) {
     return;
   }
   itemListener = AWTEventMulticaster.add(itemListener, l);
   newEventsOnly = true;
 }
コード例 #2
0
ファイル: Checkbox.java プロジェクト: ronshapiro/j86
 /**
  * Returns an array of all the objects currently registered as <code><em>Foo</em>Listener</code>s
  * upon this <code>Checkbox</code>. <code><em>Foo</em>Listener</code>s are registered using the
  * <code>add<em>Foo</em>Listener</code> method.
  *
  * <p>You can specify the <code>listenerType</code> argument with a class literal, such as <code>
  * <em>Foo</em>Listener.class</code>. For example, you can query a <code>Checkbox</code> <code>c
  * </code> for its item listeners with the following code:
  *
  * <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre>
  *
  * If no such listeners exist, this method returns an empty array.
  *
  * @param listenerType the type of listeners requested; this parameter should specify an interface
  *     that descends from <code>j86.java.util.EventListener</code>
  * @return an array of all objects registered as <code><em>Foo</em>Listener</code>s on this
  *     checkbox, or an empty array if no such listeners have been added
  * @exception ClassCastException if <code>listenerType</code> doesn't specify a class or interface
  *     that implements <code>j86.java.util.EventListener</code>
  * @see #getItemListeners
  * @since 1.3
  */
 public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
   EventListener l = null;
   if (listenerType == ItemListener.class) {
     l = itemListener;
   } else {
     return super.getListeners(listenerType);
   }
   return AWTEventMulticaster.getListeners(l, listenerType);
 }
コード例 #3
0
ファイル: Checkbox.java プロジェクト: ronshapiro/j86
  /**
   * Writes default serializable fields to stream. Writes a list of serializable <code>ItemListeners
   * </code> as optional data. The non-serializable <code>ItemListeners</code> are detected and no
   * attempt is made to serialize them.
   *
   * @param s the <code>ObjectOutputStream</code> to write
   * @serialData <code>null</code> terminated sequence of 0 or more pairs; the pair consists of a
   *     <code>String</code> and an <code>Object</code>; the <code>String</code> indicates the type
   *     of object and is one of the following: <code>itemListenerK</code> indicating an <code>
   *     ItemListener</code> object
   * @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
   * @see j86.java.awt.Component#itemListenerK
   * @see #readObject(ObjectInputStream)
   */
  private void writeObject(ObjectOutputStream s) throws j86.java.io.IOException {
    s.defaultWriteObject();

    AWTEventMulticaster.save(s, itemListenerK, itemListener);
    s.writeObject(null);
  }
コード例 #4
0
ファイル: Checkbox.java プロジェクト: ronshapiro/j86
 /**
  * Removes the specified item listener so that the item listener no longer receives item events
  * from this check box. If l is null, no exception is thrown and no action is performed.
  *
  * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" >AWT Threading Issues</a>
  * for details on AWT's threading model.
  *
  * @param l the item listener
  * @see #addItemListener
  * @see #getItemListeners
  * @see j86.java.awt.event.ItemEvent
  * @see j86.java.awt.event.ItemListener
  * @since JDK1.1
  */
 public synchronized void removeItemListener(ItemListener l) {
   if (l == null) {
     return;
   }
   itemListener = AWTEventMulticaster.remove(itemListener, l);
 }