0

我正在学习如何将 JFoenix 与 Java FX 一起使用。我在 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>

根据文档,当我们使用组件 JFXToggleButton 时,应该有某种开关按钮,例如:

在此处输入图像描述

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

在此处输入图像描述

有什么我想念的吗?非常感谢。

注意:JavaFX Scene Builder 8.5.0 JFoenix 8.0.7 使用 Maven 文档从库管理器手动添加:https ://github.com/jfoenixadmin/JFoenix/wiki/Toggle-Button#JFXButton

4

1 回答 1

0

我会将其发布为答案,因为这绝对很奇怪...

当我最终运行我的应用程序时,它给出了正确的输出,似乎使用场景构建器的预览选项不会渲染它。

于 2018-08-23T14:51:33.630 回答