JavaFX ScrollPane在右侧和底部留下一个像素边框

问题描述

我一直在开发一个程序,其中有一个 TextArea 节点,该节点正在 AnchorPane 内移动。然而,正如标题所说,TextArea 的 ScrollPane 留下了 1 像素的透明边框。这是一个问题,因为当鼠标位于此边框内时,它会将光标从 Cursor.TEXT 更改为 Cursor.DEFAULT,并且在启动 mousepressed 事件时也不会重新定位插入符号。这是问题的简单说明: example

我发现,此边框适用于所有 Scrollpanes,而不仅仅是 TextArea 中的那些。这是我用于 ScrollPane 的 css 的样子:

.scroll-pane{
    -fx-focus-color: #000000;
    -fx-background-color: transparent;
}
.text-area {
    -fx-wrap-text: true;
    -fx-background-color: transparent;
}

.text-area .scroll-pane {
    -fx-hbar-policy: never;
    -fx-vbar-policy: never;
    -fx-padding: 0;
    -fx-background-color: transparent;
}

.text-area > .scroll-pane > .scroll-bar:horizontal {
    -fx-background-radius: null;
}
.text-area > .scroll-pane > .scroll-bar:vertical {
    -fx-background-radius: null;
}
.text-area > .scroll-pane > .corner {
    -fx-background-radius: null;
}


.text-area .scroll-pane .viewport{
    -fx-background-color: transparent;
}


.text-area .scroll-pane .content{
    -fx-background-color: transparent;
}

我已经阅读了 modena.css 中 ScrollPane 的认值,并使用了它们,但不幸的是,我的问题仍然存在。

一如既往,对此事的任何意见都非常感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)