📄 frame3.java~20~
字号:
package myproject;import javax.swing.*;import java.awt.*;import com.borland.dbswing.*;import com.borland.dx.sql.dataset.*;import java.awt.event.*;public class Frame3 extends JFrame { JPanel jPanel1 = new JPanel(); JSplitPane jSplitPane1 = new JSplitPane(); JPanel jPanel2 = new JPanel(); JLabel jLabel1 = new JLabel(); JTextField jTextField1 = new JTextField(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JScrollPane jScrollPane1 = new JScrollPane(); TableScrollPane tableScrollPane1 = new TableScrollPane(); JdbTable jdbTable1 = new JdbTable(); Database database1 = new Database(); QueryDataSet queryDataSet1 = new QueryDataSet(); JButton jButton3 = new JButton(); public Frame3() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) { Frame3 frame3 = new Frame3(); } private void jbInit() throws Exception { this.setForeground(UIManager.getColor("InternalFrame.activeTitleGradient")); this.setLocale(java.util.Locale.getDefault()); this.getContentPane().setLayout(null); jPanel1.setBackground(UIManager.getColor("InternalFrame.activeTitleGradient")); jPanel1.setBounds(new Rectangle(2, 0, 399, 302)); jPanel1.setLayout(null); jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane1.setBounds(new Rectangle(-2, 1, 401, 299)); jPanel2.setBackground(UIManager.getColor("InternalFrame.activeTitleGradient")); jPanel2.setOpaque(true); jPanel2.setLayout(null); jLabel1.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel1.setOpaque(false); jLabel1.setText("联系人姓名:"); jLabel1.setBounds(new Rectangle(28, 11, 116, 42)); jTextField1.setText(""); jTextField1.setBounds(new Rectangle(105, 12, 171, 43)); jButton1.setBounds(new Rectangle(24, 66, 122, 34)); jButton1.setFont(new java.awt.Font("Dialog", 0, 13)); jButton1.setPreferredSize(new Dimension(57, 25)); jButton1.setFocusPainted(true); jButton1.setText("查询"); jButton1.addActionListener(new Frame3_jButton1_actionAdapter(this)); jButton2.setBounds(new Rectangle(152, 66, 122, 35)); jButton2.setFont(new java.awt.Font("Dialog", 0, 13)); jButton2.setText("清除"); jButton2.addActionListener(new Frame3_jButton2_actionAdapter(this)); database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:mobile", "", "", false, "sun.jdbc.odbc.JdbcOdbcDriver")); queryDataSet1.setReadOnly(false); queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select * from mobile;", null, true, Load.ALL)); jdbTable1.setBackground(UIManager.getColor("InternalFrame.activeBorderColor")); jdbTable1.setDataSet(queryDataSet1); jButton3.setBounds(new Rectangle(309, 58, 66, 40)); jButton3.setRequestFocusEnabled(true); jButton3.setText("返回"); jButton3.addActionListener(new Frame3_jButton3_actionAdapter(this)); jScrollPane1.getViewport().setBackground(UIManager.getColor("InternalFrame.activeTitleGradient")); tableScrollPane1.getViewport().setBackground(UIManager.getColor("InternalFrame.activeBorderColor")); this.getContentPane().add(jPanel1, null); jPanel1.add(jSplitPane1, null); jSplitPane1.add(jPanel2, JSplitPane.LEFT); jPanel2.add(jLabel1, null); jPanel2.add(jTextField1, null); jPanel2.add(jButton1, null); jPanel2.add(jButton2, null); jPanel2.add(jButton3, null); jSplitPane1.add(jScrollPane1, JSplitPane.RIGHT); jScrollPane1.getViewport().add(tableScrollPane1, null); tableScrollPane1.getViewport().add(jdbTable1, null); jSplitPane1.setDividerLocation(100); } void jButton1_actionPerformed(ActionEvent e) { queryDataSet1.close(); String new_sql; new_sql="select * from mobile where 联系人='"+jTextField1.getText()+"'"; queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1,new_sql, null, true, Load.ALL)); queryDataSet1.refresh(); jdbTable1.setDataSet(queryDataSet1); jdbTable1.repaint(); } void jButton2_actionPerformed(ActionEvent e) { jTextField1.setText(""); } void jButton3_actionPerformed(ActionEvent e) { this.dispose(); Frame1 ef=new Frame1(); ef.setBounds(200,150,312,380); ef.show(); ef.validate(); }}class Frame3_jButton1_actionAdapter implements java.awt.event.ActionListener { Frame3 adaptee; Frame3_jButton1_actionAdapter(Frame3 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}class Frame3_jButton2_actionAdapter implements java.awt.event.ActionListener { Frame3 adaptee; Frame3_jButton2_actionAdapter(Frame3 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); }}class Frame3_jButton3_actionAdapter implements java.awt.event.ActionListener { Frame3 adaptee; Frame3_jButton3_actionAdapter(Frame3 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton3_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -