Use Swing to implement the data table function (add to the essence Area)

Source: Internet
Author: User

A recent project was developed by delphi, where data tables are used in many areas. This function can be easily implemented in delphi and vb. java does not
This function is provided, but can be implemented using Jtable, but it is a bit of trouble :).
The following is a simple data table program code that I implemented using applet.
Package com. applet. cat10;
Import java. awt .*;
Import java. awt. event .*;
Import java. applet .*;
Import javax. swing .*;
Import com. util .*;
Import java. util .*;
Import javax. swing. table .*;
Import java. SQL .*;
/**
* Title: Cat project
* Description: BCat
* Copyright: Copyright (c) 2001
* Company: smartcomm
* @ Author daniel
* @ Version 1.0
*/
Public class TestDatabase extends JApplet {
Boolean isStandalone = false;
JButton jButton1 = new JButton (); // trigger time query button
Database db = new Database ();
JTable table1 = new JTable ();
JScrollPane scroll = new JScrollPane ();
JTextField text1 = new JTextField ();
DefaultTableModel dtm; // defines the table data model.
Vector vCdata = null; // define the table column name (stored in vector)
ResultSet rsRow = null; // query the data set of the table.
/** Construct the applet */
Public TestDatabase (){
}
/** Initialize the applet */
Public void init (){
Try {
JbInit ();
UserInit (); // user-defined operations are in the Power Method
}
Catch (Exception e ){
E. printStackTrace ();
}
}
/** Component initialization */
Private void jbInit () throws Exception {
JButton1.setText ("jButton1 ");

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.