fxmlmaterialfx

The "floatingtext" property for MaterialFx is not working properly for me - When rendered the floating text property remains hidden


For example i am using this in my fxml file:

<MFXTextField fx:id="username" floatMode="BORDER" floatingText="username" layoutX="10.0" layoutY="10.0" prefHeight="24.0" prefWidth="361.0">
               <VBox.margin>
                  <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
               </VBox.margin>
            </MFXTextField>

This renders just fine in scenebuilder, but the same loads weirdly when i run the same fxml in intellij

This is how it loads via Intellij. Notice the float text

Same fxml previewed in scenebuilder: scenebuilder

same rendering as i get with scenebuilder preview


Solution

  • Got it figured out. Was missing to set the transparent background -

     MFXThemeManager.addOn(scene, Themes.DEFAULT, Themes.LEGACY);
        scene.setFill(Color.TRANSPARENT);