ahbejarano
ahbejarano

Reputation: 58

JFXPanel resizing

I'm currently testing the integration of some JavaFX2 components in to a swing application.

I have a JFXPanel which contains an HBox Pane which holds a list of buttons. What I'm trying to achive is to hide and show some buttons and resize the HBox and the JFXPanel. Problems I'm facing:

  1. When a hide some buttons, the HBox does not resize itself.
  2. I can modify HBox size (using resize method) but I must specify the dimensions (no automatic resize) the underlying JFXPanel does not resize. The autosize method does not seem to acomplish this either.

So, How can I resize it ? I'm using FXML and controllers so I see no easy way of resizing the JFXPanel but I'm trying to see how can I manually set it, but how can this be done automatically ?

By the way, I'm not using absolute positioning in swing (no layout manager).

Upvotes: 1

Views: 1071

Answers (1)

Tangocoder
Tangocoder

Reputation: 637

Try to remove the button from the HBox, not just hide it.

I have done the same with a ToolBar & it update its size when buttons are added or removed.

Upvotes: 1

Related Questions