📄 money_dialog.java
字号:
package family;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.event.*;import com.borland.dbswing.*;import com.borland.dx.sql.dataset.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class Money_Dialog extends JDialog { JPanel panel1 = new JPanel(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JButton jButton3 = new JButton(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JdbTextField jdbTextField1 = new JdbTextField(); JdbTextField jdbTextField2 = new JdbTextField(); Database database1 = new Database(); QueryDataSet queryDataSet1 = new QueryDataSet(); QueryDataSet queryDataSet2 = new QueryDataSet(); JdbTextField jdbTextField3 = new JdbTextField(); QueryDataSet queryDataSet3 = new QueryDataSet(); GridBagLayout gridBagLayout1 = new GridBagLayout(); public Money_Dialog(Frame frame, String title, boolean modal) { super(frame, title, modal); try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public Money_Dialog() { this(null, "", false); } private void jbInit() throws Exception { panel1.setLayout(gridBagLayout1); jButton1.setFont(new java.awt.Font("DialogInput", 0, 12)); jButton1.setText("收入记录"); jButton1.addActionListener(new Money_Dialog_jButton1_actionAdapter(this)); jButton2.setFont(new java.awt.Font("DialogInput", 0, 12)); jButton2.setText("支出记录"); jButton2.addActionListener(new Money_Dialog_jButton2_actionAdapter(this)); jButton3.setText("退出"); jButton3.addActionListener(new Money_Dialog_jButton3_actionAdapter(this)); jButton3.setFont(new java.awt.Font("DialogInput", 0, 12)); jButton3.setMaximumSize(new Dimension(82, 29)); jButton3.setMinimumSize(new Dimension(82, 29)); jButton3.setPreferredSize(new Dimension(82, 29)); jLabel1.setFont(new java.awt.Font("DialogInput", 0, 12)); jLabel1.setText("收入总额:"); jLabel2.setText("支出总额:"); jLabel2.setFont(new java.awt.Font("DialogInput", 0, 12)); jLabel2.setRequestFocusEnabled(true); jLabel3.setText("结 余:"); jLabel3.setFont(new java.awt.Font("DialogInput", 0, 12)); jdbTextField1.setEditable(false); jdbTextField1.setText(""); jdbTextField1.setColumnName("total"); jdbTextField1.setDataSet(queryDataSet1); jdbTextField2.setEditable(false); jdbTextField2.setColumnName("total"); jdbTextField2.setDataSet(queryDataSet2); database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:family", "", "", false, "sun.jdbc.odbc.JdbcOdbcDriver")); database1.setDatabaseName(""); queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select sum(money) as total from inmoneys;", null, true, Load.ALL)); queryDataSet2.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select sum(money) as total from outmoneys;", null, true, Load.ALL)); jdbTextField3.setDataSet(queryDataSet3); jdbTextField3.setColumnName("total"); jdbTextField3.setEditable(false); queryDataSet3.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select sum(inmoneys.money) - sum(outmoneys.money) as total from inmoneys,outmoneys;", null, true, Load.ALL)); getContentPane().add(panel1); panel1.add(jdbTextField2, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(30, 43, 0, 0), 62, 0)); panel1.add(jButton3, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(27, 43, 42, 32), 0, 0)); panel1.add(jButton2, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(27, 43, 0, 32), 0, 0)); panel1.add(jButton1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(31, 43, 0, 32), 0, 0)); panel1.add(jdbTextField1, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(38, 43, 0, 0), 62, 0)); panel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(40, 39, 0, 0), 0, 0)); panel1.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(35, 39, 0, 0), 0, 0)); panel1.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(36, 39, 42, 0), 0, 0)); panel1.add(jdbTextField3, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(34, 45, 42, 0), 52, 0)); } void jButton1_actionPerformed(ActionEvent e) { Money_in_Dialog dlg = new Money_in_Dialog(); Dimension dlgSize = dlg.getPreferredSize(); Dimension frmSize = getSize(); Point loc = getLocation(); dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); dlg.setModal(true); dlg.pack(); dlg.show(); queryDataSet1.refresh(); queryDataSet3.refresh(); } void jButton2_actionPerformed(ActionEvent e) { Money_out_Dialog dlg = new Money_out_Dialog(); Dimension dlgSize = dlg.getPreferredSize(); Dimension frmSize = getSize(); Point loc = getLocation(); dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); dlg.setModal(true); dlg.pack(); dlg.show(); queryDataSet2.refresh(); queryDataSet3.refresh(); } void jButton3_actionPerformed(ActionEvent e) { this.dispose(); }}class Money_Dialog_jButton1_actionAdapter implements java.awt.event.ActionListener { Money_Dialog adaptee; Money_Dialog_jButton1_actionAdapter(Money_Dialog adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}class Money_Dialog_jButton2_actionAdapter implements java.awt.event.ActionListener { Money_Dialog adaptee; Money_Dialog_jButton2_actionAdapter(Money_Dialog adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); }}class Money_Dialog_jButton3_actionAdapter implements java.awt.event.ActionListener { Money_Dialog adaptee; Money_Dialog_jButton3_actionAdapter(Money_Dialog adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton3_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -