Monday, 9 March 2015

My first serious Java project

Finally here I am with my first serious Java project: a text editor!

Yeah I know, perhaps the word “serious” is a bit of an overkill for a simple project such as a text editor. However for a Java newbie, as I consider myself to be, this was actually a middle level project. The hard part was using Swing to implement the user interface, although I find Swing to be easier to use than Tkinter (Python) once that you’ve got the basics.

So, what’s this text editor about? Basically it is a notepad (like the one that comes natively with Windows but with less options, and of course it is written in Java. Here is a screenshot:


Now, let’s talk about how to use this.

The file menu:

The file menu has 4 options: open, show current working directory, set current working directory and exit.
The open command lets you search for a .txt file to display in the user-interface.
The show and change current working directory commands are used to show and change, respectively, the directory you are working in.

You can open a file with the commands “open” and “load .txt file” or work on a new one simply by typing into the white box. When you have edited a file in the text editor, you can save it by typing a name into the bottom text field and then clicking the bottom right button. If you do not enter a name, the file will be saved with a default one. Furthermore, once you click on “save .txt data” the program asks you if you want to save the file in the current working directory. If you need to choose another location click “no” and then choose the directory to save the file in. Enter the same name of the file you are working on, to overwrite it.

The edit menu:

The edit menu basically lets you change font size (by 3 pt a click).

You can download the program (the runnable .jar file and the source code) at this address below:

Hope this was interesting.

1 comment:

  1. Nice blog it is very useful for me. I have to share my website link.
    Each and every year we are providing Cheap and best students Final year projects at Madurai.