/[classpath]/classpath/javax/swing/JPasswordField.java
ViewVC logotype

Diff of /classpath/javax/swing/JPasswordField.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by mark, Sat Jul 2 20:32:48 2005 UTC revision 1.11 by langel, Mon Aug 15 19:45:58 2005 UTC
# Line 50  import javax.swing.text.Document; Line 50  import javax.swing.text.Document;
50   * class JPasswordField   * class JPasswordField
51   *   *
52   * @author Andrew Selkirk   * @author Andrew Selkirk
53     * @author Lillian Angel
54   * @version 1.0   * @version 1.0
55   */   */
56  public class JPasswordField extends JTextField  public class JPasswordField extends JTextField
# Line 178  public class JPasswordField extends JTex Line 179  public class JPasswordField extends JTex
179    }    }
180    
181    /**    /**
182     * echoCharIsSet     * Returns true if this JPasswordField has a character set for echoing.
183       * A character is considered to be set if the echo character is not 0.
184     *     *
185     * @return <code>true</code> if the echo char is set,     * @return <code>true</code> if the echo char is set,
186     * <code>false</code> otherwise.     * <code>false</code> otherwise.
187     */     */
188    public boolean echoCharIsSet()    public boolean echoCharIsSet()
189    {    {
190      return echoChar == 0;      return echoChar != 0;
191    }    }
192    
193    /**    /**
# Line 207  public class JPasswordField extends JTex Line 209  public class JPasswordField extends JTex
209    }    }
210    
211    /**    /**
212     * getText     * Returns the text contained in this TextComponent. If the
213       * underlying document is null, will give a NullPointerException.
214     *     *
215     * @return String     * @return String
216     *     *
# Line 215  public class JPasswordField extends JTex Line 218  public class JPasswordField extends JTex
218     */     */
219    public String getText()    public String getText()
220    {    {
221      return null; // TODO      try
222          {
223            return getDocument().getText(0, getColumns());
224          }
225        catch (BadLocationException ble)
226          {
227            return "";
228          }
229    }    }
230    
231    /**    /**
232     * getText     * Fetches a portion of the text represented by the component.
233       * Returns an empty string if length is 0. If the
234       * underlying document is null, will give a NullPointerException.
235     *     *
236     * @param offset TODO     * @param offset TODO
237     * @param length TODO     * @param length TODO
# Line 232  public class JPasswordField extends JTex Line 244  public class JPasswordField extends JTex
244     */     */
245    public String getText(int offset, int length) throws BadLocationException    public String getText(int offset, int length) throws BadLocationException
246    {    {
247      return null; // TODO      return getDocument().getText(offset, length);
248    }    }
249    
250    /**    /**
251     * getPassword     * Returns the text contained in this TextComponent. If the underlying
252       * document is null, will give a NullPointerException.
253       * For stronger security, it is recommended that the returned character
254       * array be cleared after use by setting each character to zero.
255     *     *
256     * @return char[]     * @return char[]
257     */     */
258    public char[] getPassword()    public char[] getPassword()
259    {    {
260      return new char[0]; // TODO      return getText().toCharArray();
261    }    }
262    
263    /**    /**
264     * paramString     * Returns a string representation of this JPasswordField. This method is
265       * intended to be used only for debugging purposes,
266       * and the content and format of the returned string may vary between
267       * implementations. The returned string may be empty but may not be null.
268     *     *
269     * @return String     * @return String
270     */     */
271    protected String paramString()    protected String paramString()
272    {    {
273      return null; // TODO      try
274          {
275            return getText();
276          }
277        catch (NullPointerException npe)
278          {
279            return "";
280          }
281    }    }
282    
283    /**    /**

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26