When I first started out in programming, I made the same mistake I now see countless people make when starting. I wrote code for me and that worked, and that was good enough for me. As time passed and the code I produced expanded and became more ambitious so my bad habits became more ingrained. I think it is something we all do; we all go through. It is not until we encounter an issue, a reason to change, that we appreciate the error of our ways. If we are fortunate we get an opportunity to work with other more worldly wise programmers who can help us adopt good habits; if not then we need hard lessons to alter our behaviour.
Previously I had written a blog called “Wrap Java into an executable with Launch4J”. The title for the article I now realise was perhaps misleading in that it only covered how to download the tool and install. I understand that some readers may actually want an example of how to convert their Java code into an actual executable. This aims to address that short coming.Continue reading “Wrap Java into an executable with Launch4J-Part 2”
If your java desktop application needs to store data in a database between sessions then a good solution is to embed a database into your solution. What this gives you is an application which installs the database as part of the application, builds the database tables and populates it with any initial data. This approach avoids the need for the user to install a database separately from the application.
Let’s takes a look at how to you might go about this.
In the previous post we looked at displaying information in a hierarchy using JTree.
Now all this is fine but, usually when we use a JTree it is because we want to be able to select an item, one or more. For our example let us concern ourselves with selecting a single item and displaying the detail associated with that item. Continue reading “Using JTree to select information”
The other day I came across an example where a formula written in a Java program could be represented as a standard equation on the screen. I thought this was brilliant. I recall back in my Uni days using the formula editor in Microsoft Word to present formulas. Now I don’t have a use for this in Java yet but, you never know. However, in case anyone out there does have a requirement to produce a formula from within their Java program then maybe this will help.
The challenge is to produce an output that looks like this:
Traversing the file system is one of the common tasks required in applications. Search the web for examples and you can find plenty of examples of how to go about it. One of the most popular is to work through the file system using recursive calls like this: Continue reading “Traversing the file system”
Imagine we have a small JavaFX application. We are building this application in Eclipse, although this should not make any material difference, you could build it in using any IDE or simple command line tools.
This application has some java files under the “src” folder. There is also a “resources” folder which contains some none java files which the application will reference. Added to this we are using some 3rd party JAR libraries. Finally, we have a text-based properties file for our application.
Our project structure looks like this:
We are going to use ANT to produce a Windows executable application. The steps we need to take to do this are: – Continue reading “ANT – A worked example”
ANT – Another Neat Tool
Ant is a tool developers use to package up an application to hand over to deployment. Continue reading “What is Apache Ant?”
I was reading a blog the other day and the author was talking about writing a Java application in 10 minutes as a test. They finished off by saying that even with time to consider the solution they do not think they could improve upon it. When I looked at the code my first thought was “what a mess”, Continue reading “The only right way to write code!”
In the last post we saw how you can easily create a JTree using an array of strings. The JTree however did not display the values in a hierarchy but displayed all the values at the same level. So in this post we will build our Java Desktop Application using JTree with a hierarchy.