Traversing To and Fro with SQL Server Based Java Applications using NetBeans IDE
This series introduces you to a step-by-step process for developing Java (or JFC) based applications with Microsoft SQL Server as the database, using NetBeans IDE. In this article (which is the last in this series), I shall introduce you to traversing through a set of rows more efficiently. This will be a bit different from any of the articles in this series.
In the above code, I explicitly defined the initial size of the frame and connected to the database. As this is the constructor, it is automatically executed. Once executed, it tries to connect to the database, retrieve the information and populate the same into the result set. Once we get into the result set, we then assign the values to all controls on the form.
I made the following variables global to the class level:
When you define any variable (or reference/object) outside all the methods but within the same class, they will be treated as class level variables (or references/objects). They are accessible to every method within the class (without any re-declarations or re-instantiations). All the above declarations get instantiated within the constructor, which gets automatically executed, when the form is loaded (or the class gets instantiated) for the first time.