我需要回显特定字符,而不是在 JTextField
中按下的键。
产生的效果就像我按 k
键,但 *
出现在文本字段中。
最佳答案
使用 JPasswordField
怎么样?反而?它是 JTextField
that allows the editing of a single line of text where the view indicates something was typed, but does not show the original characters.
(引自 Javadoc)
关于需要动态转换字符的附加内容,您可能需要查看 Javadoc for JTextField
中带有 UpperCaseField
的 UpperCaseField
示例。 。它可以很容易地转换成某种逻辑,将每个字符转换为另一个字符。
关于java - 如何在 JTextField 中回显字符而不是按下的键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15702527/