<commit_before>//
// $Id$
//
// BUI - a user interface library for the JME 3D engine
// Copyright (C) 2005, <NAME>, All Rights Reserved
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.jmex.bui;

/**
 * A derivation of {@link BTextField} that does not display the actual
 * text, but asterisks instead.
 */
public class BPasswordField extends BTextField
{
    public BPasswordField ()
    {
    }

    public BPasswordField (String text)
    {
        super(text);
    }

    // documentation inherited
    protected String getDisplayText ()
    {
        String text = super.getDisplayText();
        if (text == null) {
            return null;
        } else if (_stars == null || _stars.length() != text.length()) {
            StringBuffer stars = new StringBuffer();
            for (int ii = 0; ii < text.length(); ii++) {
                stars.append("*");
            }
            _stars = stars.toString();
        }
        return _stars;
    }

    protected String _stars;
}<commit_msg>Password fields should also be able to specify a max input length<commit_after>//
// $Id$
//
// BUI - a user interface library for the JME 3D engine
// Copyright (C) 2005, <NAME>, All Rights Reserved
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.jmex.bui;

/**
 * A derivation of {@link BTextField} that does not display the actual
 * text, but asterisks instead.
 */
public class BPasswordField extends BTextField
{
    public BPasswordField ()
    {
    }

    public BPasswordField (int maxLength)
    {
        super(maxLength);
    }

    public BPasswordField (String text)
    {
        super(text);
    }

    public BPasswordField (String text, int maxLength)
    {
        super(text, maxLength);
    }

    // documentation inherited
    protected String getDisplayText ()
    {
        String text = super.getDisplayText();
        if (text == null) {
            return null;
        } else if (_stars == null || _stars.length() != text.length()) {
            StringBuffer stars = new StringBuffer();
            for (int ii = 0; ii < text.length(); ii++) {
                stars.append("*");
            }
            _stars = stars.toString();
        }
        return _stars;
    }

    protected String _stars;
}
{'fraction_non_alphanumeric': 0.09463548830811554, 'fraction_numerical': 0.012104539202200825, 'mean_word_length': 2.486097794822627, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7379651', 'n_tokens_mistral': 995, 'n_tokens_neox': 931, 'n_words': 428}