Subject | Re: [Firebird-Java] JTables |
---|---|
Author | Herman Timmermans |
Post date | 2003-09-24T15:41:55Z |
On Wednesday 24 September 2003 15:47, Francisco Vieira wrote:
Hello,
I've included here a short java program that uses a component called
QuickTable, it is a complete JTable alternative Javabean. It has all the
features which are missing in JTable and it is built on top of JTable, so you
don't have to learn any new API.
If you want to learn more about it : http://dbtable.hypermart.net/home.htm
And for your convenience, the short program that was tested running Firebird
1.0 with Jaybird JDBC driver, with Suse Linux 8.1 with Sun J2sdk1.4.1_02.
import javax.swing.*;
import quick.dbtable.*;
import java.sql.*;
public class QuickTableDemo extends JFrame
{
public QuickTableDemo(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);
// 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();
dBTable1.setConnection(dbConnection);
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("org.firebirdsql.jdbc.FBDriver").newInstance();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
// create a database connection
Connection dbConnection = DriverManager.getConnection (
"jdbc:firebirdsql://linuxserver//opt/interbase/examples/employee.gdb","sysdba","masterkey");
// create a new table frame
QuickTableDemo myframe = new QuickTableDemo(dbConnection);
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
Hope this is helpfull,
Sorry for the long posting
Greetings,
Herman
--
****************** E-Mail Privacy disclaimer ************
This message and any attachments thereto are confidential. They may also
be privileged or otherwise protected by work product immunity or other
legal rules. If you have received it by mistake, please let us know by
e-mail reply and delete it from your system; you may not copy this
message or disclose its contents to anyone.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted, lost, destroyed, arrive late
or incomplete, or contain viruses. The sender therefore is in no way
liable for any errors or omissions in the content of this message, which
may arise as a result of e-mail transmission. If verification is required,
please request a hard copy.
> Could anybody tell me where can I get some GOOD material (tutorial, book,******************************************************************
> anything....) about JTables?
> I have to put Data Tables IN JTables and JTables in Data Tables.
>
> Thank you.
> ---
> Outgoing mail is certified Virus Free.
>
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003
Hello,
I've included here a short java program that uses a component called
QuickTable, it is a complete JTable alternative Javabean. It has all the
features which are missing in JTable and it is built on top of JTable, so you
don't have to learn any new API.
If you want to learn more about it : http://dbtable.hypermart.net/home.htm
And for your convenience, the short program that was tested running Firebird
1.0 with Jaybird JDBC driver, with Suse Linux 8.1 with Sun J2sdk1.4.1_02.
import javax.swing.*;
import quick.dbtable.*;
import java.sql.*;
public class QuickTableDemo extends JFrame
{
public QuickTableDemo(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);
// 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();
dBTable1.setConnection(dbConnection);
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("org.firebirdsql.jdbc.FBDriver").newInstance();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
// create a database connection
Connection dbConnection = DriverManager.getConnection (
"jdbc:firebirdsql://linuxserver//opt/interbase/examples/employee.gdb","sysdba","masterkey");
// create a new table frame
QuickTableDemo myframe = new QuickTableDemo(dbConnection);
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
Hope this is helpfull,
Sorry for the long posting
Greetings,
Herman
--
****************** E-Mail Privacy disclaimer ************
This message and any attachments thereto are confidential. They may also
be privileged or otherwise protected by work product immunity or other
legal rules. If you have received it by mistake, please let us know by
e-mail reply and delete it from your system; you may not copy this
message or disclose its contents to anyone.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted, lost, destroyed, arrive late
or incomplete, or contain viruses. The sender therefore is in no way
liable for any errors or omissions in the content of this message, which
may arise as a result of e-mail transmission. If verification is required,
please request a hard copy.