Search code examples
javafx-8togglebuttonuiswitchjfoenix

Jfoenix JFXToggleButton does not provide switch appearance


I am learning how to use JFoenix with Java FX. I am using it from SceneBuilder so the only code I can show is that one :

<?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>

According to the documentation when we the componenet JFXToggleButton whe should have some sort of switch button like :

enter image description here

But this is not what I have on my side, all I can get is a simple Toggle Button like :

enter image description here

Is there something I am missing ? Thanks a lot.

Note : JavaFX Scene Builder 8.5.0 JFoenix 8.0.7 added manually from Library Manager with Maven Documentation : https://github.com/jfoenixadmin/JFoenix/wiki/Toggle-Button#JFXButton


Solution

  • I'll post this as an answer as this is definitely weird...

    When I finally run my application it is giving the correct output, it seems that using preview option of scene builder does not render it.