/[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.5.2.5 by gnu_andrew, Tue Aug 2 20:12:37 2005 UTC revision 1.5.2.6 by gnu_andrew, Sat Sep 10 15:31:49 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, getDocument().getLength());
224          }
225        catch (BadLocationException ble)
226          {
227            // This should never happen.
228            throw new AssertionError(ble);
229          }
230    }    }
231    
232    /**    /**
233     * getText     * Fetches a portion of the text represented by the component.
234       * Returns an empty string if length is 0. If the
235       * underlying document is null, will give a NullPointerException.
236     *     *
237     * @param offset TODO     * @param offset TODO
238     * @param length TODO     * @param length TODO
# Line 232  public class JPasswordField extends JTex Line 245  public class JPasswordField extends JTex
245     */     */
246    public String getText(int offset, int length) throws BadLocationException    public String getText(int offset, int length) throws BadLocationException
247    {    {
248      return null; // TODO      return getDocument().getText(offset, length);
249    }    }
250    
251    /**    /**
252     * getPassword     * Returns the text contained in this TextComponent. If the underlying
253       * document is null, will give a NullPointerException.
254       * For stronger security, it is recommended that the returned character
255       * array be cleared after use by setting each character to zero.
256     *     *
257     * @return char[]     * @return char[]
258     */     */
259    public char[] getPassword()    public char[] getPassword()
260    {    {
261      return new char[0]; // TODO      return getText().toCharArray();
262    }    }
263    
264    /**    /**
265     * paramString     * Returns a string representation of this JPasswordField. This method is
266       * intended to be used only for debugging purposes,
267       * and the content and format of the returned string may vary between
268       * implementations. The returned string may be empty but may not be null.
269     *     *
270     * @return String     * @return String
271     */     */
272    protected String paramString()    protected String paramString()
273    {    {
274      return null; // TODO      try
275          {
276            return getText();
277          }
278        catch (NullPointerException npe)
279          {
280            return "";
281          }
282    }    }
283    
284    /**    /**

Legend:
Removed from v.1.5.2.5  
changed lines
  Added in v.1.5.2.6

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