我正在学习如何在Java中使用JFoenix。我在SceneBuilder中使用它,所以我能展示的唯一代码是:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<SplitPane id="sp_main" dividerPositions="0.29797979797979796" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.171">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<VBox layoutX="-1.0" prefHeight="398.0" prefWidth="174.0">
<children>
<Pane prefHeight="200.0" prefWidth="200.0" />
<Pane prefHeight="200.0" prefWidth="200.0" />
<Pane id="p_action" prefHeight="200.0" prefWidth="200.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" />
<JFXToggleButton />
</children>
</Pane>
</children>
</VBox>
</children></AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
</items>
</SplitPane>根据文档,当我们使用componenet whe时,应该有一些开关按钮,比如:

但这不是我所拥有的,我能得到的只是一个简单的切换按钮,比如:

我是不是漏掉了什么?非常感谢。
注意: JavaFX Scene Builder 8.5.0 JFoenix 8.0.7是从库管理器手动添加的,包含Maven文档:https://github.com/jfoenixadmin/JFoenix/wiki/Toggle-Button#JFXButton
发布于 2018-08-23 22:51:34
我会把这个作为答案,因为这绝对是很奇怪的……
当我最终运行我的应用程序时,它给出了正确的输出,似乎使用场景构建器的预览选项不能渲染它。
https://stackoverflow.com/questions/51967530
复制相似问题