Home arrow Java arrow Page 3 - Traversing To and Fro with SQL Server Based Java Applications using NetBeans IDE
JAVA

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.

Author Info:
By: Jagadish Chaterjee
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
June 28, 2006
TABLE OF CONTENTS:
  1. · Traversing To and Fro with SQL Server Based Java Applications using NetBeans IDE
  2. · How to connect to the database during form load
  3. · The Java code from IDE
  4. · The source code for buttons
  5. · How to handle the clear memory resources when the form is closed

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Traversing To and Fro with SQL Server Based Java Applications using NetBeans IDE - The Java code from IDE
(Page 3 of 5 )

In this section, I shall give you some overview of the code generated behind the scenes.  I already explained the code generated in the previous article.  All of my introductory articles really explain each and every statement for the code generated behind the scenes.  To make it simple, I shall list the most important code, which is a bit different from other articles.

As you know, the button declaration will be a bit different from the others, as it has some "event" to be published.  The following is the code for the same:

btnFirst.setLabel("<<");
        btnFirst.addActionListener(new
java.awt.event.ActionListener() {
            public void actionPerformed
(java.awt.event.ActionEvent evt) {
                btnFirstActionPerformed(evt);
            }
        });
        getContentPane().add(btnFirst);
        btnFirst.setBounds(20, 130, 51, 23);
        btnPrevious.setLabel("<");
        btnPrevious.addActionListener(new
java.awt.event.ActionListener() {
            public void actionPerformed
(java.awt.event.ActionEvent evt) {
                btnPreviousActionPerformed(evt);
            }
        });
        getContentPane().add(btnPrevious);
        btnPrevious.setBounds(90, 130, 50, 23);
        btnNext.setLabel(">");
        btnNext.addActionListener(new
java.awt.event.ActionListener() {
            public void actionPerformed
(java.awt.event.ActionEvent evt) {
                btnNextActionPerformed(evt);
            }
        });
        getContentPane().add(btnNext);
        btnNext.setBounds(150, 130, 43, 23);
        btnLast.setLabel(">>");
        btnLast.addActionListener(new
java.awt.event.ActionListener() {
            public void actionPerformed
(java.awt.event.ActionEvent evt) {
                btnLastActionPerformed(evt);
            }
        });
        getContentPane().add(btnLast);
        btnLast.setBounds(210, 130, 51, 23);

The above code will simply add "listeners" to all the buttons designed on our form. That code will be present if and only if you double click on every button to write some code (with respect to that button).  You can also observe that every button is instantiated, labeled, registered with its own listener, and added to the content panel based on the bounds defined by the user.


blog comments powered by Disqus
JAVA ARTICLES

- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...
- Generics and Limitations in Java
- Getting Started with Java Web Development in...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials