1. /*
  2. * @(#)BasicPasswordFieldUI.java 1.28 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.basic;
  8. import java.awt.*;
  9. import javax.swing.*;
  10. import javax.swing.text.*;
  11. import javax.swing.event.*;
  12. import javax.swing.plaf.*;
  13. /**
  14. * Provides the Windows look and feel for a password field.
  15. * The only difference from the standard text field is that
  16. * the view of the text is simply a string of the echo
  17. * character as specified in JPasswordField, rather than the
  18. * real text contained in the field.
  19. *
  20. * @author Timothy Prinzing
  21. * @version 1.28 01/23/03
  22. */
  23. public class BasicPasswordFieldUI extends BasicTextFieldUI {
  24. /**
  25. * Creates a UI for a JPasswordField.
  26. *
  27. * @param c the JPasswordField
  28. * @return the UI
  29. */
  30. public static ComponentUI createUI(JComponent c) {
  31. return new BasicPasswordFieldUI();
  32. }
  33. /**
  34. * Fetches the name used as a key to look up properties through the
  35. * UIManager. This is used as a prefix to all the standard
  36. * text properties.
  37. *
  38. * @return the name ("PasswordField")
  39. */
  40. protected String getPropertyPrefix() {
  41. return "PasswordField";
  42. }
  43. /**
  44. * Creates a view (PasswordView) for an element.
  45. *
  46. * @param elem the element
  47. * @return the view
  48. */
  49. public View create(Element elem) {
  50. return new PasswordView(elem);
  51. }
  52. }