📄 crdialog.java
字号:
package myproject;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.ResultSet;
/**
* <p>Title: 审计档案管理系统
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author 郭伟超
* @version 1.0
*/
public class CrDialog extends JDialog {
private JPanel panel1 = new JPanel();
private JLabel jLabel1 = new JLabel();
private XYLayout xYLayout1 = new XYLayout();
private JTextField wjmField = new JTextField("中国人民银行关于国有粮食购销企业原附营业务贷款实行停息挂账等额核减农发行再贷款利息的批复");
private JLabel jLabel2 = new JLabel();
private JButton jButton1 = new JButton();
private JButton jButton2 = new JButton();
private Border border1;
private JScrollPane jScrollPane1 = new JScrollPane();
private JTextArea nrtext = new JTextArea();
private Connection con;
public CrDialog(Frame2 frame, String title, boolean modal) {
super(frame, title, modal);
try {
this.con = frame.con1;
jbInit();
pack();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public CrDialog() {
this(null, "插入对话框", false);
}
private void jbInit() throws Exception {
border1 = BorderFactory.createEmptyBorder(0,10,15,20);
panel1.setLayout(xYLayout1);
jLabel1.setToolTipText("");
jLabel1.setText("请输入 文件名:");
jLabel2.setText("请输入内容:");
jButton1.setText("确定");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jButton2.setText("取消");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton2_actionPerformed(e);
}
});
panel1.setBorder(border1);
panel1.add(jLabel1, new XYConstraints(16, 20, 93, 33));
panel1.add(wjmField, new XYConstraints(104, 25, 201, 28));
panel1.add(jLabel2, new XYConstraints(16, 62, 80, 28));
panel1.add(jScrollPane1, new XYConstraints(18, 92, 310, 133));
panel1.add(jButton1, new XYConstraints(104, 238, -1, -1));
panel1.add(jButton2, new XYConstraints(190, 238, -1, -1));
jScrollPane1.getViewport().add(nrtext, null);
this.getContentPane().add(panel1, BorderLayout.CENTER);
}
void jButton2_actionPerformed(ActionEvent e) {
this.setVisible(false);
this.dispose();
}
//插入按钮事件
void jButton1_actionPerformed(ActionEvent e) {
try{
String str_sy=wjmField.getText();
String str_nr=nrtext.getText();
Statement sta = con.createStatement();
String str_tk="select tk_id=MAX(tk_id) from fltw where sy_id ='"+wjmField.getText()+"'";
ResultSet set = sta.executeQuery(str_tk);
set.next();
int tkid=set.getInt(1);
tkid += 1;
String str1="";
str1="insert into fltw ";
str1=str1+" values ('"+str_sy+"',";
str1=str1+tkid+",'";
str1=str1+str_nr+"')";
sta.executeUpdate(str1);
}catch(SQLException e2){
e2.printStackTrace();
System.out.println("error!!!");}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -