home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / IFC_112 / netscape / application / TextFieldOwner.java < prev    next >
Encoding:
Text File  |  1999-05-28  |  3.6 KB  |  92 lines  |  [TEXT/CWIE]

  1. // TextFieldOwner.java
  2. // By Ned Etcode
  3. // Copyright 1996, 1997 Netscape Communications Corp.  All rights reserved.
  4.  
  5. package netscape.application;
  6.  
  7. import netscape.util.*;
  8.  
  9. /** Interface implemented by objects wanting information on important TextField
  10.   * events, such as when editing has completed.  An object implementing this
  11.   * interface must make itself the TextField's owner using the TextField's
  12.   * <b>setOwner()</b> method.
  13.   */
  14.  
  15. public interface TextFieldOwner {
  16.     /** Edit mode will end (or did end) because the TextField received a Tab
  17.       * key.
  18.       */
  19.     public static final int     TAB_KEY = 0;
  20.  
  21.     /** Edit mode will or did end because the TextField received a
  22.       * BackTab key.
  23.       */
  24.     public static final int     BACKTAB_KEY = 1;
  25.  
  26.     /** Edit mode will or did end because the TextField received a
  27.       * Return key.
  28.       */
  29.     public static final int     RETURN_KEY = 2;
  30.  
  31.     /** Edit mode will or did end because another TextField acquired
  32.       * key focus.
  33.       */
  34.     public static final int     LOST_FOCUS = 3;
  35.  
  36.     /** Edit mode will or did end  because the TextField resigned key
  37.       * focus.
  38.       */
  39.     public static final int     RESIGNED_FOCUS = 4;
  40.  
  41.  
  42.  
  43.     /** Sent by <b>textField</b> upon entering edit mode.
  44.      */
  45.     public void textEditingDidBegin(TextField textField);
  46.  
  47.     /** Sent by <b>textField</b> each time the user changes the
  48.       * <b>textField</b>'s contents.
  49.       */
  50.     public void textWasModified(TextField textField);
  51.  
  52.     /** Sent by <b>textField</b> when it is about to complete editing.
  53.       * <b>endCondition</b> describes why editing will end, with the possible
  54.       * values TAB_KEY, BACKTAB_KEY, RETURN_KEY, LOST_FOCUS, and
  55.       * RESIGNED_FOCUS.  For TAB_KEY, BACKTAB_KEY, and RETURN_KEY, returning
  56.       * <b>false</b> causes the TextField to remain in edit mode, and
  57.       * returning <b>true</b> allows editing to complete.  With the LOST_FOCUS
  58.       * and RESIGNED_FOCUS conditions, the TextField exits edit mode
  59.       * regardless of the return value (when another TextField requests input
  60.       * focus, or the TextField resigns it voluntarily, there's no way to
  61.       * prevent it).  <b>contentsChanged</b> is <b>true</b> if
  62.       * the TextField's contents have been modified since entering edit mode.
  63.       */
  64.     public boolean textEditingWillEnd(TextField textField, int endCondition,
  65.                                       boolean contentsChanged);
  66.  
  67.     /** Sent by <b>textField</b> when text editing has completed.
  68.       * <b>endCondition</b> describes why editing ended, with the possible
  69.       * values TAB_KEY, BACKTAB_KEY, RETURN_KEY, LOST_FOCUS, and
  70.       * RESIGNED_FOCUS.  <b>contentsChanged</b> is <b>true</b> if the
  71.       * TextField's contents were modified since entering edit mode.<p>
  72.       * If you need to implement special behavior when the user switches
  73.       * TextFields using keystrokes (Tab, Return, and so on), do it in this
  74.       * method.  For example, if you need to determine which TextField should
  75.       * receive keys next without using TextField's existing
  76.       * <b>setTabField()</b> and <b>setBacktabField()</b> methods, you could
  77.       * use the following code for this method:
  78.       * <pre>
  79.       *     if (endCondition == TextFieldOwner.RETURN_KEY) {
  80.       *         field1.selectText();
  81.       *     } else if (endCondition == TextFieldOwner.TAB_KEY) {
  82.       *         field2.selectText();
  83.       *     } else if (endCondition == TextFieldOwner.BACKTAB_KEY) {
  84.       *         field3.selectText();
  85.       *     }
  86.       * </pre>
  87.       */
  88.     public void textEditingDidEnd(TextField textField, int endCondition,
  89.                                   boolean contentsChanged);
  90. }
  91.  
  92.