1 /* 2 * Copyright (c) 2001-2005 JGoodies Karsten Lentzsch. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * o Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * 10 * o Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * o Neither the name of JGoodies Karsten Lentzsch nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 package com.jgoodies.looks.plastic; 32 33 34 import javax.swing.JComponent; 35 import javax.swing.JPasswordField; 36 import javax.swing.plaf.ComponentUI; 37 import javax.swing.plaf.basic.BasicPasswordFieldUI; 38 import javax.swing.text.Element; 39 import javax.swing.text.View; 40 41 import com.jgoodies.looks.common.ExtPasswordView; 42 43 /** 44 * The JGoodies PlasticXP Look&Feel implementation of a password field UI 45 * delegate. It differs from its superclass in that it utilizes a password 46 * view that renders a dot, not a star ("*") as echo character. 47 * 48 * @author Karsten Lentzsch 49 * @version $Revision: 1.2 $ 50 */ 51 public final class PlasticXPPasswordFieldUI extends BasicPasswordFieldUI { 52 53 /** 54 * Creates a UI for a {@link JPasswordField}. 55 * 56 * @param c the password field component 57 * @return the UI 58 */ 59 public static ComponentUI createUI(JComponent c) { 60 return new PlasticXPPasswordFieldUI(); 61 } 62 63 /** 64 * Creates and returns a view (an <code>ExtPasswordView</code>) for an element. 65 * 66 * @param elem the element 67 * @return the view 68 */ 69 public View create(Element elem) { 70 return new ExtPasswordView(elem); 71 } 72 73 74 }