I have this code, done and functions really well on console but I need to transfer it to GUI, for example I have 4 operations, which are calculating and processing median, mode, mean and standard deviation. As a result of that, I need to have 4 text field inputs and one button calculating the 4 operations and display either on the program itself or pop up.

```
import javax.sound.midi.SysexMessage;
import java.util.Arrays;
import java.util.*;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.text.Text;
import java.applet.*;
import javax.swing.*;
public class FinalProg {
Button button;
public static void main(String[] args)
{
// int[] dataSet = {1,2,3,4,345,312,756,0,-234321132,234};
// int[] dataSet = {5,3,2,5,2,5,758,345,32,231,5,5,5,2,2};
// Scanner scanner = new Scanner(System.in);
// String input = scanner.nextLine();
//
//
//
//
//
//
//
//
//
// int [] dataSet = new int[input.length()];
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine(); //Numbers inputted from user in your case
String[] list; //List to store individual numbers
list = input.split(" "); // Regex to split the String so you get each number
//Mean
int sum = 0;
for (String n : list) {
sum += Integer.parseInt(n);
}
System.out.println("The mean of the data set is " +
((double) sum / list.length));
//Median
Arrays.sort(list);
// if (list.length % 2 != 0) {
// System.out.println("The median of the data set is: " + Double.parseDouble(list[list.length / 2]));
// } else {
// float median = (Integer.parseInt(list[list.length/2]+Integer.parseInt(list[(list.length/2)-1])) / 2f );
// System.out.println("The median of the data set is: " + median);
//// System.out.println("The median of the data set is: " + Double.parseDouble(list[list.length / 2] + list[list.length / 2 - 1]) / 2.0);
// }
if (list.length % 2 == 0) {
System.out.println("The median of the data set is: " + Double.parseDouble(list[list.length / 2]) + Double.parseDouble(list[list.length / 2 - 1]) / 2);
} else {
// float median = (Integer.parseInt(list[list.length/2]+Integer.parseInt(list[(list.length/2)-1])) / 2f );
System.out.println("The median of the data set is: " + list[list.length / 2]);
// System.out.println("The median of the data set is: " + Double.parseDouble(list[list.length / 2] + list[list.length / 2 - 1]) / 2.0);
}
//Mode
int maxNumber = -1;
int maxAppearances = -1;
for (int i = 0; i < list.length; i++) {
int count = 0;
for (int j = 0; j < list.length; j++) {
// if (list[i] == list[j]) {
// count++;
// }
if (list[i].equals(list[j])) {
count++;
}
}
if (count > maxAppearances) {
maxNumber = Integer.parseInt(list[i]);
maxAppearances = count;
}
count = 0;
}
System.out.println("The mode of the data set: " + maxNumber);
//STDV
double STDVsum = 0.0, standardDeviation = 0.0;
int length = list.length;
for (String num : list) {
STDVsum += Double.parseDouble(num);
}
double mean = STDVsum / length;
// for(String num: list) {
// standardDeviation += Double.parseDouble(Math.pow(num - mean, 2)); // It says operator - doesn't apply...
// }
for (String num : list) {
int num_to_Integer = Integer.parseInt(num);
standardDeviation += Math.pow(num_to_Integer - mean, 2); //No need to parse now
}
System.out.println("STDV " + Math.sqrt(standardDeviation / length));
}
}
```