我正在用 Java 制作一个表单,我想用滚动条可视化文本区域,问题是我多次将 .setVisible()
值从 true 更改为 false,反之亦然我不知道要更改什么,滚动 Pane 还是文本区域?
例如:
public void pantallaInicio() {
imagen.setVisible(false);
existencia_lb.setVisible(false);
subtotal_lb.setVisible(false); ... }
//And I also have this one:
public void pantallaAgregar() {
imagen.setVisible(true);
existencia_lb.setVisible(true);
subtotal_lb.setVisible(true); ...}
// Here is where I don't know if I should change the ScrollPane or the TextArea value.
最佳答案
I don't know what to change, the scroll pane or the text area
都不是。在构建滚动 Pane 时将文本区域添加到滚动 Pane 中。将滚动 Pane 添加到 GUI。当顶层窗口(通常是 JFrame
)设置为可见时,文本区域和滚动 Pane 都将可见。
关于java - 将 JTextarea 添加到 JScrollPane。什么是可见的,第一还是第二?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61831329/