java表格就是java swing。
敖漢ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
//創(chuàng)建表頭
String[] columnNames = { "First Name", "Last Name", "Sport",
"# of Years", "Vegetarian" };
//創(chuàng)建顯示數(shù)據(jù)
Object[][] data = {
{ "Kathy", "Smith", "Snowboarding", new Integer(5),
new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) },
{ "Sue", "Black", "Knitting", new Integer(2),
new Boolean(false) },
{ "Jane", "White", "Speed reading", new Integer(20),
new Boolean(true) },
{ "Joe", "Brown", "Pool", new Integer(10), new Boolean(false) } };
/*
* JTable還提供了一個(gè)重載的構(gòu)造方法,傳入兩個(gè)Vector
* JTable(Vector rowData, Vector columnNames)
*
*/
final JTable table = new JTable(data, columnNames);
table.setBackground(Color.YELLOW);
Connection conn = 鏈接
Statement stmt = conn.createStatementI();
String sql = "CREATE TABLE PFO_ANALYSE_BRANCH ( "
+" NODE_NAME_S VARCHAR2(50 BYTE), "
+ 其他字段
+")";
stmt.execute(sql)
可以用FineReport報(bào)表軟件實(shí)現(xiàn)。finereport是純java軟件,類excel設(shè)計(jì)模式,是一款功能極其牛掰的表格工具,可與數(shù)據(jù)庫直接對接(一般的數(shù)據(jù)庫,Oracle,SqlServer,MySql,DB2,Sybase,Informix等都支持),文本數(shù)據(jù)直接導(dǎo)入當(dāng)然也支持,企業(yè)級額應(yīng)用中包括設(shè)置定時(shí)報(bào)表、自定匯總數(shù)據(jù)發(fā)送郵件、報(bào)表權(quán)限分配、決策平臺搭建等,因?yàn)槭菍I(yè)的報(bào)表軟件,功能很強(qiáng)大,其實(shí)很多業(yè)內(nèi)人士都在用這款軟件,另外幾乎不用自己編寫代碼,所以新手很容易上手使用。應(yīng)該會比較適合您的,滿意的話可以采納的哦,謝謝了
import?java.sql.*;
public?class?Test
{
public?static?void?main(String[]?args)?throws?Exception
{
Class.forName("com.mysql.jdbc.Driver");
//一開始必須填一個(gè)已經(jīng)存在的數(shù)據(jù)庫
String?url?=?"jdbc:mysql://localhost:3306/test?useUnicode=truecharacterEncoding=utf-8";????
Connection?conn?=?DriverManager.getConnection(url,?"root",?"123456");
Statement?stat?=?conn.createStatement();
//創(chuàng)建數(shù)據(jù)庫hello
stat.executeUpdate("create?database?hello");
//打開創(chuàng)建的數(shù)據(jù)庫
stat.close();
conn.close();
url?=?"jdbc:mysql://localhost:3306/hello?useUnicode=truecharacterEncoding=utf-8";
conn?=?DriverManager.getConnection(url,?"root",?"123456");
stat?=?conn.createStatement();
//創(chuàng)建表test
stat.executeUpdate("create?table?test(id?int,?name?varchar(80))");
//添加數(shù)據(jù)
stat.executeUpdate("insert?into?test?values(1,?'張三')");
stat.executeUpdate("insert?into?test?values(2,?'李四')");
//查詢數(shù)據(jù)
ResultSet?result?=?stat.executeQuery("select?*?from?test");
while?(result.next())
{
System.out.println(result.getInt("id")?+?"?"?+?result.getString("name"));
}
//關(guān)閉數(shù)據(jù)庫
result.close();
stat.close();
conn.close();
}
}