Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 JavaFX 和 CSS 的新手。我正在使用 Scene Builder,并且有一个我想用作菜单栏的手风琴。我希望手风琴的背景要么是透明的,要么与它后面的页面背景相匹配,并且文本是完全不透明的和不同的颜色。另外,我不希望出现文本旁边的箭头。我已经尝试了 Scene Builder 提供的各种选项,但没有一个能让我做这两件事中的任何一件。这是我需要用 CSS 做的事情吗?如果是,怎么做?
我用css解决了这个问题。JavaFX 使用名为 caspian.css 的文件作为其标准样式。手风琴模块包含由标题和内容区域组成的标题窗格。要删除内容的背景颜色,您需要覆盖标题窗格的 styleClass:
.accordion .titled-pane > *.content { -fx-background-color: null; }
如果您不想在应用程序范围内覆盖样式,您还可以将自定义 styleClass 分配给标题窗格或手风琴。希望这可以帮助。