[Solved] Is there a Desktop-like view for JavaFx desktop application?


You should try to use flow pane of JavaFX, it will add children in flow. You can give icons to them on conditions like if you get the directory then give the folder icon else file icon like this.

Refer to this for the Flow Pane
and Layout building

Example :

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

public class DemoFile extends Application {

@Override
public void start(Stage primaryStage) throws Exception {
    FlowPane flowPane = new FlowPane();
    for (int i = 0; i < 20; i++) {
        Button button = new Button("File Name or folder name");
        button.setPrefSize(200, 200);
        flowPane.getChildren().add(button);
    }
    Scene scene = new Scene(flowPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}

public static void main(String[] args) {
    launch(args);
}
}

Try this example in which I have added 20 buttons in flow pane but you can change the component as you wish you can also set the padding of flow pane to give the spacing between the children’s of flow pane

3

solved Is there a Desktop-like view for JavaFx desktop application?