FXML Making a VBox invisible in the controller

221 views Asked by At

I've done some research and there doesn't seem to be any questions like this concerning the controller so here I go. So I have wrapped some shapes in Vboxes in SceneBuilder.

<VBox fx:id="vStand" layoutX="403.0" layoutY="175.0" prefHeight="8.0" prefWidth="164.0" rotate="90.0">
         <children>
            <Line fx:id="stand" endX="163.0" stroke="#806565" style="-fx-opacity: 0;" />
         </children>
      </VBox>

You can change the opacity in here, but then the code for this not in the controller.

So I have attempted to do it through the controller. But unfortunately this does not work?

 @FXML
    private VBox vstand;


   @FXML 
   private void hide(ActionEvent event) {
        vstand.setOpacity(0);
   }

Is it because you can't assign a method to a VBox as you could with a label or button therefore meaning the action of the item being opaic is not being performed??

I should mention what I wanted to do was make the object disappear through making it opaic and the reappear by setting opacity to 100.

Although I have considered using the setVisible now I'm intrigued as to how you could get the opacity to work.

0

There are 0 answers