X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTPasswordField.java;h=9c200d7dc7dcfea44a2fef0d3f59f8df9505ec81;hb=738dd8c426dcc6ed2508d68b7985f68d66549889;hp=d68a21c45bbac5a4804aca46fea7d217d2f24946;hpb=0d47c5460c8e9d1198928308767a63ad35f46eb8;p=fanfix.git diff --git a/src/jexer/TPasswordField.java b/src/jexer/TPasswordField.java deleted file mode 100644 index d68a21c..0000000 --- a/src/jexer/TPasswordField.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Jexer - Java Text User Interface - * - * License: LGPLv3 or later - * - * This module is licensed under the GNU Lesser General Public License - * Version 3. Please see the file "COPYING" in this directory for more - * information about the GNU Lesser General Public License Version 3. - * - * Copyright (C) 2015 Kevin Lamonte - * - * This program 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 3 of - * the License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, see - * http://www.gnu.org/licenses/, or write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - * @author Kevin Lamonte [kevin.lamonte@gmail.com] - * @version 1 - */ -package jexer; - -import jexer.bits.CellAttributes; -import jexer.bits.GraphicsChars; - -/** - * TField implements an editable text field. - */ -public final class TPasswordField extends TField { - - /** - * Public constructor. - * - * @param parent parent widget - * @param x column relative to parent - * @param y row relative to parent - * @param width visible text width - * @param fixed if true, the text cannot exceed the display width - */ - public TPasswordField(final TWidget parent, final int x, final int y, - final int width, final boolean fixed) { - - this(parent, x, y, width, fixed, "", null, null); - } - - /** - * Public constructor. - * - * @param parent parent widget - * @param x column relative to parent - * @param y row relative to parent - * @param width visible text width - * @param fixed if true, the text cannot exceed the display width - * @param text initial text, default is empty string - */ - public TPasswordField(final TWidget parent, final int x, final int y, - final int width, final boolean fixed, final String text) { - - this(parent, x, y, width, fixed, text, null, null); - } - - /** - * Public constructor. - * - * @param parent parent widget - * @param x column relative to parent - * @param y row relative to parent - * @param width visible text width - * @param fixed if true, the text cannot exceed the display width - * @param text initial text, default is empty string - * @param enterAction function to call when enter key is pressed - * @param updateAction function to call when the text is updated - */ - public TPasswordField(final TWidget parent, final int x, final int y, - final int width, final boolean fixed, final String text, - final TAction enterAction, final TAction updateAction) { - - // Set parent and window - super(parent, x, y, width, fixed, text, enterAction, updateAction); - } - - /** - * Draw the text field. - */ - @Override - public void draw() { - CellAttributes fieldColor; - - boolean showStars = false; - if (isAbsoluteActive()) { - fieldColor = getTheme().getColor("tfield.active"); - } else { - fieldColor = getTheme().getColor("tfield.inactive"); - showStars = true; - } - - int end = windowStart + getWidth(); - if (end > text.length()) { - end = text.length(); - } - - getScreen().hLineXY(0, 0, getWidth(), GraphicsChars.HATCH, fieldColor); - if (showStars) { - getScreen().hLineXY(0, 0, getWidth() - 2, '*', - fieldColor); - } else { - getScreen().putStringXY(0, 0, text.substring(windowStart, end), - fieldColor); - } - - // Fix the cursor, it will be rendered by TApplication.drawAll(). - updateCursor(); - } - -}