Let ListView grow : ListView « JavaFX « Java






Let ListView grow

 
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
 
public class Main extends Application {

    @Override
    public void start(final Stage stage) {
        stage.setTitle("HTML");
        stage.setWidth(500);
        stage.setHeight(500);
        Scene scene = new Scene(new Group());
 
        VBox vbox = new VBox();
        ListView list = new ListView();
        VBox.setVgrow(list, Priority.ALWAYS);
        vbox.getChildren().addAll(new Label("Names:"), list);
        
        scene.setRoot(vbox);

        stage.setScene(scene);
        stage.show();
    }
 
    public static void main(String[] args) {
        launch(args);
    }
}

   
  








Related examples in the same category

1.ListView with data binding
2.Color Rect List Cell
3.List selected Item property
4.ListView selection listener
5.ListView auto filter
6.Display first and last name with tooltip using alias for ListView