Create ListView in JavaFX
Create ListView in JavaFX:
________________________________________________
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class JavaFXListView extends Application {
@Override
public void start(Stage stage) {
ObservableList<String> programs = FXCollections.observableArrayList("Java", "Python", "C#");
ListView<String> programsList = new ListView<String>(programs);
FlowPane pane = new FlowPane(programsList);
Scene scene = new Scene(pane, 250, 250);
stage.setTitle("JavaFX ListView");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
_____________________________________________
Dark Hers
YouTube
https://instagram.com/darkhers
https://www.facebook.com/darkhers
TikTok
https://www.tiktok.com/@darkhers
https://www.pinterest.co.uk/darkhers
Comments
Post a Comment