craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)
topcurve.gif (60 bytes)
Tutorial
Setup

Basic Table

Existing Connection

Add/Modify/Delete

 

Use wizard to configure Quicktable, less programming required!
Using existing Connection with   Quicktable

   This example uses existing Connection object with quickTable.

import javax.swing.*;
import quick.dbtable.*;
import java.sql.*;

public class ExistingConnectionFrame extends JFrame
{
   public ExistingConnectionFrame(Connection dbConnection)
   {
      //set Frame properties
      setSize(300,200);
      setVisible(true);

      //create a new quicktable
      quick.dbtable.DBTable dBTable1 = new quick.dbtable.DBTable();

      //add to frame
      getContentPane().add(dBTable1);

      dBTable1.setConnection(dbConnection);

      // set the select statement which should be used by the table
      dBTable1.setSelectSql("select * from employee");

      //to create the navigation bars for the table
      dBTable1.createControlPanel();

      try
      {
         //fetch the data from database to fill the table
         dBTable1.refresh();
      }
      catch(SQLException e)
      {
         e.printStackTrace();
      }

   }

   public static void main(String[] args)
   {
      try
      {
         //Load your jdbc driver
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

      }
      catch( ClassNotFoundException e)
      {
         e.printStackTrace();
      }

      try
      {
         //create a database connection
         Connection dbConnection = DriverManager.getConnection ("jdbc:odbc:quicktabledemo");

         //create a new table frame
         ExistingConnectionFrame myframe = new ExistingConnectionFrame(dbConnection);

      }
      catch(SQLException e)
      {
         e.printStackTrace();
      }

   }
}

botcurve.gif (60 bytes)
botblack.gif (108 bytes)