Rounded edges java fx

0

I want to make the edges of my applications rounded, such as Mac OS, however the result I get is the following:

How can I remove the white piece that remains in the corners of the application?

This is my code:

Main class :

public void start(Stage stage) throws Exception {

    Parent root = FXMLLoader.load(getClass().getResource("Preview.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Ejemplo Drag And Drop");
    stage.show();
}

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    launch(args);
}

And the css file:

.mainFxmlClass {
#pane{
    -fx-background-size: 800 900;
    -fx-background-radius: 0 0 18 18;
    -fx-border-radius: 0 0 18 18;
    -fx-border-width:5;
    -fx-background-color: #FC3D44;
}
    
asked by F.Stan 23.07.2017 в 16:53
source

1 answer

0

You must change the fill color of the Scene object to transparent, like this:

scene.setFill(Color.TRANSPARENT);

You should also change the style of the window to transparent, like this:

stage.initStyle(StageStyle.TRANSPARENT);

The problem is that, this action removes the edges of the window, so you must create the buttons to: minimize, maximize and close the window.

You can see an example in: window with rounded edges in JavaFX

    
answered by 23.07.2017 / 23:21
source