JavaFX 8中的ScrollPanes始终具有灰色背景 [英] ScrollPanes in JavaFX 8 always have gray background

查看:660
本文介绍了JavaFX 8中的ScrollPanes始终具有灰色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过JavaFX应用程序从JavaFX 2升级到JavaFX 8时,我注意到ScrollPanes总是显示为灰色矩形,即使背景颜色设置或背景设置为透明。

When I upgraded by JavaFX app from JavaFX 2 to JavaFX 8, I noticed that ScrollPanes always showed up as gray rectangles, even with a background color set or the background set to be transparent.

推荐答案

我在这次讨论中找到了解决方案: https ://community.oracle.com/thread/3538169

I found the solution in this discussion: https://community.oracle.com/thread/3538169

首先我需要这个:

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

然后我可以将背景颜色设置为我喜欢的颜色。在这种情况下,我将使所有ScrollPane背景透明:

Then I could set the background color to whatever I like. In this case, I'm making all ScrollPane backgrounds transparent:

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

这篇关于JavaFX 8中的ScrollPanes始终具有灰色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆