![](/img/trans.png)
[英]JavaFX: 2 radio buttons are disabling a text field, when one of them is selected
[英]JavaFX keep scroll event activated when disabling text edition
我有一个javaFX Node,它是javaFX TextArea。
我想禁用版本BUT以便也可以在文本上滚动。
我知道“ setMouseTransparent(boolean)”会停用所有鼠标事件检测。
到目前为止,这是我的代码:
private void manageReadability(Node control, boolean writeMode) {
if (writeMode) {
control.setMouseTransparent(false);
} else {
control.setMouseTransparent(true);
// I would like to be able to scroll the text field
}
有没有一种方法可以禁用文本编辑,而只让鼠标在滚动事件上侦听?
在JavaFX的文本区域中,您只需要设置editable标志。
myTextArea.setEditable(false);
这将允许您复制文本,滚动等-但不允许您进行编辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.