Of course we designed and created a Graphical User Interface for
the comparison tool so that it will be intuitive and easy-to-use for the client. That is why we created the class MyFrame which extends JFrame and also implements WindowListener – used only for window closing. We used a FlowLayout.The class has as attributes: two string variables that will store the absolute path for the two xml files that will be selected from the computer memory, two integer variables that will store whether those two files were (1) or were not (0) selected and two string variables that will hold the files’s names (for all these we created getters and setters as these are all private attributes), in addition to swing components which will be presented here. So when the client runs the program, a small window with measures: 300 horizonal and 360 vertical will appear. On the top of the window we have placed two JLabels for the two xml files and to their right two JButtons that have the word “CHOOSE” written on them. We added action listeners to each of these two buttons. We had to implement custom action listener classes. The constructor for such a class must take as an argument a variable of type MyFrame, because it will have to change some of its attributes. In the actionPerformed function in both these action listener functions, with the use of JFileChooser, a dialog box opens in order to allow the use to select the xml file from the computer with ease. The process is a familiar one. Now when the user selects a file, attributes such as path, file name and isSelected (which I presented above; these are attributes of MyFrame element that came in with the constructor) will receive values based on the location of the file, the name of the file and the integer value will become now 1. Under these components we have four JRadioButtons that have as values the different options you can choose for the program to print: first one for same name but value differences, second one for elements that are missing from the second file, third one for the elements that are missing from the first file and the fourth one called “ALL” for printing all of these. As default, the fourth button is selected. We combined these to a ButtonGroup so that only one of these can be selected when we press the “COMPARE” button that you can find under the RadioButton group. When this button is pressed, because it also have a custom action listener, first of all it checks whether or not both files have been selected, and if that is true then it proceeds to the action performed function in the Comp class – which is the name of the custom action listener. And from there on it runs the algorithm.