user3210171 user3210171 - 1 year ago 214
Java Question

Scene Builder: How to hide borders on panels, etc

I'm just starting with Scene Builder and java. I've laid out my main GUI but when I preview it, it has wide borders for all my h/v boxes, anchor panels, etc. How do I hide the borders when I actually run (preview) my UI? Is there a way in scene builder (preferred) or will I have to code this instead?

Answer Source

Default border on layouts

There is no default border on layouts which can be visible. In case, you need to remove border from layouts you can set css code using setStyle() method,

yourPane.setStyle("-fx-border-width: 0px");

You can also use external css document for styling components.

Wide border on preview

Actually, the fxml preview means that showing your design in a window. So you might confusing with window frame border.Something like this,

window frame with border

But you can make borderless window by styling your stage using initStyle() ,


You can also may use TRANSPARENT instead. After that you have to manage your title bar for customized window.

customized undecorated window

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download