Java : Abstract Singleton

In this assignment I was tasked with creating a factory using Java code that can create three different GUI elements for a mock-up word program. The three elements were a panel, button, and textbox. This mock-up word program is constantly developing, so new iterations are always released, such as Word00, Word10, Word18 and so forth. To accomplish this goal, I had to integrate a singleton design scheme into an abstract factory pattern. We do not want to use a singleton pattern for the various types of Word objects we can create, as each one will have a different style of GUI and look a little different in each iteration. Therefore, we must abstract the elements using an abstract factory pattern which will allow us to return different instances that share a foundational class. A UML diagram of this is given below.

To run this assignment, download the source files located at the bottom of this page.

After downloading the files, extract the java class files located in the src folder into a package in your eclipse or whichever IDE you are using, and navigate to the MainDriver.java file. This java class file contains the code to run the overall program along with extensive comments that helps with understanding what the code is doing. The code runs off of a provided .txt file, called ConfigA2.txt

A demo of how to run the program is given below, and here are some example screenshots of running this assignment.

Source Files