How do I animate a process scheduling algorithm in java?

I am a newbie to java I would like to know how to animate a process scheduling algorithm in java so that the interface doesn't look plain. Based on my research I saw a Swing library in java that could be used to get me that animation however I am not sure how to get it done exactly. Are there any key points that just used to get my code animated? Thank You.

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
//Use a class to keep track of the current processes status.
public class RoundRobin {
    public int burstTime;
    public int arrivalTime;
    public int completionTime;
    public int remainingRunTime;

    // Initialize processes with an arrival time and burst time
    public RoundRobin(int arrivalTimeValue, int burstTimeValue) {
        burstTime = burstTimeValue;
        arrivalTime = arrivalTimeValue;
        completionTime = -1;
        remainingRunTime = burstTime;
    }
    public class Main {
        // Use a class to keep track of the current processes status.
        
    
        public static void main(String[] args) {
            System.out.println("Average Waiting time");
    
            float waity;
            int arrival[] = { 0, 0 };
            int burst[] = { 4, 4 };
            waity = roundRobin(arrival, burst, 3);
    
            System.out.println(waity);
    
            // waity = roundRobin({},{},3);
    
            // System.out.println(waity);
    
        }
    
        static public float roundRobin(int[] arrivalTimes, int[] burstTimes, int quantumTime) {
            // Avoid divide by zero
            if (arrivalTimes.length == 0)
                return 0;
    
            // processes can be either arriving, running or finished
            List<RoundRobin> arrivingProcesses = new ArrayList<RoundRobin>();
            Queue<RoundRobin> runningProcesses = new LinkedList<RoundRobin>();
            List<RoundRobin> finishedProcesses = new ArrayList<RoundRobin>();
    
            // Create all processes in arriving
            for (int i = 0; i < arrivalTimes.length; i++) {
                arrivingProcesses.add(new RoundRobin(arrivalTimes[i], burstTimes[i]));
            }
            // I assume the arrays already list the processes based on priority.
            // If there is another way you want to choose priority then you should sort
            // arrivingProcesses
    
            int currentTime = 0;
    
            // Simulate time until the processes are all finished
            while (!(arrivingProcesses.isEmpty() && runningProcesses.isEmpty())) {
    
                // First add any arriving processes to the queue
                for (int i = arrivingProcesses.size() - 1; i >= 0; i--) {
                    if (arrivingProcesses.get(i).arrivalTime <= i) {
                        runningProcesses.add(arrivingProcesses.get(i));
                        arrivingProcesses.remove(i);
                    }
                }
    
                // Run the first item in the queue
                if (!runningProcesses.isEmpty())
                    runningProcesses.peek().remainingRunTime--;
    
                currentTime++;
    
                // finish process if run time is 0
                if (runningProcesses.peek().remainingRunTime == 0) {
                    runningProcesses.peek().completionTime = currentTime;
                    finishedProcesses.add(runningProcesses.remove());
                }
    
                // if the quantum time is reached, put the process in the back
                if (currentTime % quantumTime == 0 && !runningProcesses.isEmpty()) {
                    runningProcesses.add(runningProcesses.remove());
                }
    
            }
    
            // Calculate total waiting time
            float totalWaitTime = 0;
    
            for (RoundRobin checkProcess : finishedProcesses) {
                totalWaitTime += (checkProcess.completionTime - (checkProcess.arrivalTime + checkProcess.burstTime));
            }
    
            // return the average
            return totalWaitTime / arrivalTimes.length;
    
        }
    
    }
}

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum