Skip to content

A JavaFX/Java Swing Consumable Library for getting random users data with abundant details from api provided by https://random-data-api.com/

License

Notifications You must be signed in to change notification settings

k33ptoo/KRandomUser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KRandomUser

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
   */
  ExecutorService es = Executors.newCachedThreadPool();
  Task<ObservableList<T>> t = new Task() {
        @Override
        protected Object call() throws Exception {
            ObservableList<T> oLst = FXCollections.observableArrayList();
            KRandomUser.fetchRandomUserList(50, list -> {
                for (KRandomUserModel f : list) {
                    oLst.add(/*whatever infor you want*/);
                }
            });
            return oLst;
        }

    };
    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

About

A JavaFX/Java Swing Consumable Library for getting random users data with abundant details from api provided by https://random-data-api.com/

Topics

Resources

License

Stars

Watchers

Forks

Languages