Every Writer needs a Reader(Java inclined assistance)

Hi, fellas. I just created a free program which makes it possible to create what I call ‘Story trees’.

Story Trees are stories that don’t have to have just one ending. Short-story writers, novelists and such will find this program invaluable. This program would make it possible for writers to push their imaginations, to provide several plausible possibilities to the same situation of a character.

In the end, story trees give human readers a more enjoyable reading experience cos they get to follow a character all over again through some other path in the story tree.

StoryTree documents are saved with a .str file extension, but inside them is just plain xml. The xml simply holds info about the coordinates of parts of the story and the coordinates of the branches, and also the text assigned to each part of the story.

I need someone(s) to program a standard reader(not too complex, though) for this writer program(I found it a bit difficult to do myself, okay I’ll confess, the reader I wrote is just too lame to make public.) and post the link to download the reader here for checking out. I used IzPack to make the Java installer for the Writer program, then used Launch4j to make the installer a .exe. I know a lot of people don’t have the java runtime environment already installed in their computers so I went the extra mile to make it easy for non-programmers to use.

The link to the StoryTreeWriter installer is http://www.4shared.com/file/7tOLL0a_/StoryTreeExeInstaller.html , it also includes the source code(I wasn’t kidding when I said this program is free). Try out the program and any comments or problems you encounter(my code wasn’t too commented so I expect some bewilderment) can be posted here.

Lets make story-trees a reality. Let something good come out of Nigeria.

My emails are [email protected] and [email protected]. My phone number is +2347037122181.


The executable didn’t work for me. It says it was packaged to run with an internal JRE but after extracting it there wasn’t any.

This is how I installed it.

If you have WINRAR extract the executable (StoryTreeExeInstaller.exe). This is possible because it is a packed and compressed executable.
Then run this command from the “command line” if you have the java bin directory in your path:
java com.izforge.izpack.installer.Installer
Won’t go into details of setting your path as I assume you should have done this.

Checking it out though…

Ok! It has installed but here’s what it’s saying:

This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupt.
See what you can do about that. I’ll be keeping a close watch on this post and will try something out myself.


Ok! I’ve finally succeeded in running it but I still had to extract the final executable and execute it’s contents directly using the “java” interpreter.

BTW, it doesn’t actually save it in the file; I think you should find a way to save it in the XML document probably by adding another node called “story” or “text”.
Also think a user should have the ability to name a node whatever he/she likes. For now the nodes are named based on an index.

I like it though. Good work. My emails are [email protected] and [email protected], please contact me if anything comes up. However I’d like to work on this with you and other developers, I might have a few ideas to give.

I’ve been working on the program on my computer alone and in the run down village where I’m at I can’t test the program on another system. I think I should have just stuck with the program being a Java archive.

I’ll upload another version of the installer program and post the link here, so that you guys can just double-click the installer in order to install the program, but this time the program will be with a java archive. This would be a great way to test Java’s so called ‘platform independence’ if someone ran my program on a mac or linux machine.

Sorry for giving anyone any inconvenience.


I hope this installer has no problems.

@vicstar did you try reading the help I put in the program? If you did was it good enough.
And by the way, the image I attached should give a good hint about how to use the program.
When text is typed in the text area and the ‘Save’ button is pressed, any node currently selected will be assigned the text in the text area. It is when you are done working on the StoryTree can you then ‘Create’ the actual storytree, by clicking the ‘Create’ button. If this is done in the .str file you should see the text as a text element under the StoryNode node. Even if you don’t press the ‘Create’ button, the program will ask you to save your story tree when you want to close the program.

I’ll think about the suggestion you made about giving a user the chance to name each node. Thanks for your input.

@vicsstar the reader I had in mind should be something like Adobe reader, but without all those unnecessary stuff that nobody uses. The reader I had in mind will simply provide a convenient means to view the story tree, click on a node, and see the page displayed. There should also be previous page, next page, and page jump functionality. The text on a page should be big enough for anyone to read, so there’ll be no need for all that zoom in, zoom out crap.

What I had in mind should look something like the image I attached suggests.

I like the second screenshot (63), looks more like a reader.
Ok! I’ve seen it actually save. A good feature, but you know some people will like formatted text, you know (bold, italic, center aligned), it’s all possible.
But hey, there’s no rush, so take your time to get to that stage.

I will also like to suggest you use groovy in conjunction with Java as it provides excellent XML manipulation features which I think the application clearly needs instead of writing bloated XML manipulation code (SAX, DOM etc).

The code that helps protect the user from accidentally closing the application without saving currently shows an option pane with two options YES and NO; this is ok but in the long run I think these are however insufficient since some users might not be interested in saving yet (YES) or even closing (NO), which the application does, it should also include a cancel button which still aborts the entire SAVE or CLOSE operation.

The first step towards implementing this is that you need to call the “setDefaultCloseOperation” method on the “JFrame” passing “JFrame.DO_NOTHING_ON_CLOSE” constant as parameter. The current code doesn’t do this and therefore forces you as the programmer to give the user the option of either clicking YES to save or NO which closes the application without saving.


This will give you the flexibility of giving your users many options including aborting the close operation.

@Prometheus: I’d like to propose the use of Groovy to handle business logic and for providing easy access to most static/dynamic assets like text, could come in really handy and slash your biz-logic code by almost half if not more.
e.g: look at this code extracted from the About.java source file:

“Hi! It\'s just me for now.
“My name is Efe Ariaroo.”+
“I\'m just a guy who doesn\'t like leaving a character after he
" is through reading a good novel.
"My email is [email protected], and
“my cell number is +2347037122181

“I know the software is too simple, but isn’t that what we all need?”

Could just simply have been written as:

// dynamically create a method to replace new lines (
) with html line breaks (
String.metaClass.nl2br {
', ‘

Then your code:

“”"Hi! It’s just me for now.
My name is #.
I’m just a guy who doesn’t like leaving a character after he
is through reading a good novel.
My email is #, and
my cell number is #\

I know the software is too simple, but isn’t that what we all need?""".nl2br();

NB: you only have to define the nl2br() method once in the lifecycle of your program.

Will definitely cut down on keystrokes.
Another good thing about this is that you can reuse the method throughout the entire program from when it was created.

To cut the long story, I think groovy should be used for the many of the NON-GUI parts of the StoryTree program and could be a good way to have a feel of a true Java-based dynamic language.

I will upload a copy of the program and post the link here containing a re-implementation of the NON-GUI parts in groovy + any improvements I can make.

@vicsstar Hey, men. Thanks so much. Coding something all alone can make one feel like a cave man. I’ll check out groovy to see if it is something I can quickly study now. There are just too many things(ant, iText, cloud computing, spring, struts, hibernate, rest, db4o, derby etc) I see on the web, so I get confused on which to learn.

I think we should do just email correspondence from now on. What do you think? I don’t think our talk would be missed.

Lol… Understand your point. No biggie, I agree (email correspondence), but let me just say this here:
You don’t have to learn everything, you can ask questions, search about whatever you intend to learn on the internet and know which is better suited for you.
One way to know this could be to read the intro into the language, framework or technology and see if it excites you (probably an answer to some of the questions beckoning in your mind).
All the technologies and frameworks you mentioned are familiar to me, but I only know how to use a few (cloud computing, hibernate, rest), just began using ant and iText. Refused (for personal or intellectual reasons and the reasons I explained) to learn spring, struts, db4o, but haven’t had the chance to learn derby.

Talk to you soon.