gpt4 book ai didi

java - JTextArea 使文本不可见

转载 作者:行者123 更新时间:2023-11-30 04:50:51 26 4
gpt4 key购买 nike

我希望我的 JTextArea 仅显示插入符号。我已将 JTextArea 设置为不透明,但无法隐藏文本。我如何实现这个目标

JTextArea text = new JTextArea();
text.setOpaque(false);//This doesn't make text transparent

最佳答案

这段代码:

JTextArea a = new JTextArea();
a.setText("hello, world!");
a.setForeground(new Color(0, 0, 0, 0));

当我测试它时,它似乎工作正常,它使设置文本和键入文本都变得不可见。

关于java - JTextArea 使文本不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9851968/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com