Path: blob/master/src/demo/share/jfc/TableExample/README.txt
41152 views
The four examples in this directory show how to use some of the1features of the JTable component.23TableExample:4This application includes a GUI for configuring the5database connection and specifying the query.6TableExample2:7The query and database connection are specified at the command8line. The results are displayed in a JTable.9TableExample3:10Is a minimal example showing how to plug a generic sorter into the11JTable.12TableExample4:13Uses specialized renderers and editors.1415TableExample3 and TableExample4 do not depend on database connectivity16and can be compiled and run in the normal way.1718The most interesting example is probably TableExample, which has a19TextArea that can be used as an editor for an SQL expression. Pressing20the Fetch button sends the expression to the database. The results are21displayed in the JTable underneath the text area.2223To run TableExample and TableExample2, you need to find a driver for24your database and set the environment variable JDBCHOME to a directory25where the driver is installed. See the following URL for a list of26JDBC drivers provided by third party vendors:2728http://java.sun.com/products/jdbc/drivers.html2930Once you find the driver, you can run one of the database examples by31specifying a class path that includes the JDBC classes and the example32classes.3334For example:3536java -classpath $(JDBCHOME):TableExample.jar TableExample3738These instructions assume that this installation's version of the java39command is in your path. If it isn't, then you should either40specify the complete path to the java command or update your41PATH environment variable as described in the installation42instructions for the Java(TM) SE Development Kit.43444546