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


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Applet Issues Post New Topic   Post A Reply
All applet issues - Read this first printer friendly version
next newest post
Author Messages
sirpappy{@}bigfoot.com
Unregistered
Edit or delete this message Reply w/Quote
Posted Wednesday, December 31, 1969 @ 19:00:00  

I am using Visual Cafe 3 and was able to compile the dtable source code into a class and run it in the visual environment for testing. I am new at java programming and know little, how do I run it as a stand alone application and distribute the app? I would also like to run it as an applet. How do I create an applet and how do I include the dtable source code into it? I tried, my html code will invoke the class file and the database window pops up for about a second and then closes. I am sure I have not created it properly as an applet. Any source code examples would greatly help me to learn by example. <br>Any takers that can tutor me on this example?<br>Rick<br>sirpappy@bigfoot.com

admin{@}quicktable.org
Unregistered
Edit or delete this message Reply w/Quote
Posted Wednesday, December 31, 1969 @ 19:00:00  

This is quick example of using quicktable with applet
the issues are
1) you should have a jdbc driver which can work in firewall, if you don't have that kind of driver, you will get errors if u try to access this applet behind firewall
2) the database should be running in the same machine where you have the webserver, otherwise u wil get security exception
3) Try to use this applet with Java plugin , rather than using swingall.jar as I've given
4) if you just have the applet class and html in a local filesystem , not in a webserver and if u try to open the applet html in a browser, u will get security exceptions sometimes. better try running from a webserver

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

public class DBTableApplet extends JApplet
{
public void init() {

setSize(300,200);

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

//add to applet
getContentPane().add(dBTable1, BorderLayout.CENTER);

//set the database driver to be used
dBTable1.setDatabaseDriver("oracle.jdbc.driver.OracleDriver");

/*
set the jdbc url,"quicktabledemo" is the data source we have created
for the database
*/
dBTable1.setJdbcUrl("jdbc:oracle:thin:@WNYCEQT5125020:1521:orcl");
dBTable1.setUser("scott");
dBTable1.setPassword("tiger");

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

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

try
{
//connect to databae & create a connection
dBTable1.connectDatabase();

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

}
}

And the html page
(Assuming the TestApplet.class (applet class),quicktable2swing11.jar (quicktable library),classes111.zip(jdbc driver),swingall.jar (swing classes, needed only if the jdk doesn't support swing) are located in the same directory as the html

<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>
HTML Test Page
</TITLE>
</HEAD>
<BODY>
<APPLET
CODEBASE = "."
CODE = "DBTableApplet.class"
NAME = "TestApplet"
WIDTH = 400
HEIGHT = 300
HSPACE = 0
VSPACE = 0
ALIGN = middle
ARCHIVE ="quicktable2swing11.jar,classes111.zip,swingall.jar"
>
</APPLET>
</BODY>
</HTML>

On , Rick wrote:
I am using Visual Cafe 3 and was able to compile the dtable source code into a class and run it in the visual environment for testing. I am new at java programming and know little, how do I run it as a stand alone application and distribute the app? I would also like to run it as an applet. How do I create an applet and how do I include the dtable source code into it? I tried, my html code will invoke the class file and the database window pops up for about a second and then closes. I am sure I have not created it properly as an applet. Any source code examples would greatly help me to learn by example.
Any takers that can tutor me on this example?
Rick
sirpappy@bigfoot.com



Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios