A JavaFX /Java Swing Consumable Library for getting 100 random users data with abundant details from api provided by https://random-data-api.com/
Usage
Maven
<dependency>
<groupId>com.k33ptoo</groupId>
<artifactId>KRandomUser</artifactId>
<version>1.0.1</version>
</dependency>
Code
/** * How to use on Java Swing * InvokeLater to prevent UI Blocking */SwingUtilities.invokeLater(()->{
KRandomUser.fetchRandomUserList(50, (List<KRandomUserModel> data) -> {
//do something with the list of data
}); }); /** * How to use on JavaFX without blocking the UI * You have to run on a task */ExecutorServicees = Executors.newCachedThreadPool();
Task<ObservableList<T>> t = newTask() {
@OverrideprotectedObjectcall() throwsException {
ObservableList<T> oLst = FXCollections.observableArrayList();
KRandomUser.fetchRandomUserList(50, list -> {
for (KRandomUserModelf : list) {
oLst.add(/*whatever infor you want*/);
}
});
returnoLst;
}
};
es.submit(t);
t.setOnSucceeded((evt) -> {
tableView.setItems(t.getValue());
});
Other user details are as follows
Credits to Marko Manojlovic for developing such an awesome free api.
For more information about the api visit https://random-data-api.com/documentation
