Desktop dictionary

DESKTOP DICTIONARY is a dictionary I made while in university studying computer science.

I took the words and their meanings from the open source Webster's Unabridged Dictionary. From the picture above, you can see that I have referenced the source of the words at the bottom. 

I built the dictionary using JAVA and JAVAFX. I initially built the first version, but it I did not include concurrency and this made it slow. This version, I included multithreading. This made the dictionary very fast and took advantage of the cores in a multicore computer. I also used CSS extensively and worked with java 8's New Input Output (NIO) method. When the dictionary is started, it loads the words and their meanings from a text file into an arrayList. This list is used throughout the use of the dictionary. When a user makes changes to the user interface of the dictionary, this is saved to disc.

Features of the Desktop Dictionary

It performs the function of a dictionary, but not all dictionaries contain antonyms and synonyms. This dictionary contains all that. However it does not contain all the common words used today. From the toolbar in the image below, you can see that I included features such as 'History' button, for viewing search history. Also 'Favorites' button, for viewing your favorite searched words, 'font size' button for making the texts bigger or smaller, etc. The dictionary allows you to search for an exact word, a word that starts/ends with a particular letter or phrase, etc. The 'starred' button is used to save a word to your the favorites's list.

first interface of the DESKTOP DICTIONARY

sample source code of home interface

The IDE I developed with was Intellij Idea Community Edition. The comments of the source are in green and yellow. I commented the code so its self explanatory.

Favorites - section

The list of your favorite words are stored here. Clicking on the 'favorites' button on the tool bar displays this list

sample source code of the 'favorites' feature

The readFavorites() method contains the block of code that takes care of reading the list of favorite words. I commented the source code so there is not much for me to write about here.

Font Color - section

There are numerous font colors to choose from. I selected the list  of font colors from CSS

sample source code of the 'Font Color' feature

The list of font colors is stored in an arrayList called fontColorObservableList. I used an arrayList because I was planning to make the user include his own font colors later.

Font Size - section

'Font size' button loads the list of font sizes onto the listView. The bigger the font number, the bigger the texts appear.

sample source code of the 'font size' feature

Font sizes are stored in an array. The important function of writeSettings() method is to save the choice of font size of the user to disc. 'settings.file' stores the settings of the user. When the dictionary is loaded into memory, writeSettings() method is called to read the saved font settings into the application

History - section

All searched words are stored in the history section of the dictionary. The oldest search appears first and the newest appears last. The scrollbar is used to access the words that are not visible on the screen.

sample source code of the 'History' feature

readHistory() method performs one function. It loads the history of searched words from disc. history.txt file stores the history. Each word in this text file occupies one line. So in the source code below, line 564 uses a while loop to iterate through the contents of the history file after its loaded into an inputStream. 

Background - section

The user clicks on 'background' button to change the appearance of the dictionary's interface.  His choice is saved to a file so anytime he reopens the dictionary, his saved settings will be loaded back and the dictionary's background color will be set to it

sample source code of the 'Background color' feature

from line 166 of the code below, button backgroundColor is an instance variable of class Dictionary_app_Main. it is declared above the constructor of the class but it is initialized in the constructor. I did that because I wanted the button to be loaded onto the primaryStage of the GUI as soon as the application launches. However, initializing instance variables in a constructor is not recommended, for security reasons. The next time I update this application, I will fix this