📄 mysqlsaveframe.java
字号:
package save;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.dx.sql.dataset.*;import com.borland.dbswing.*;public class MySQLSaveFrame extends JFrame { JPanel contentPane; BorderLayout borderLayout1 = new BorderLayout(); Database database1 = new Database(); QueryDataSet queryDataSet1 = new QueryDataSet(); JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar(); TableScrollPane tableScrollPane1 = new TableScrollPane(); JdbTable jdbTable1 = new JdbTable(); public MySQLSaveFrame() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); this.setSize(new Dimension(400, 300)); this.setTitle("MySQL数据库存储操作"); //建立与MySQL的books数据库的联接 database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor( "jdbc:mysql://localhost:3306/books?user=root;password=", "", "", false, "org.gjt.mm.mysql.Driver")); //取得bookcategory数据表的记录 queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor( database1, "select * from books", null, true, Load.ALL)); jdbNavToolBar1.setDataSet(queryDataSet1); jdbTable1.setDataSet(queryDataSet1); contentPane.add(jdbNavToolBar1, BorderLayout.NORTH); contentPane.add(tableScrollPane1, BorderLayout.CENTER); tableScrollPane1.getViewport().add(jdbTable1, null); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -