📄 dstory.java
字号:
package cn.hebut;
import javax.swing.JPanel;
import java.awt.Frame;
import java.awt.BorderLayout;
import javax.swing.JDialog;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.MessageFormat;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
public class Dstory extends JDialog {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
public JTextField jdestorynum = null;
private JPasswordField jdestoryPassword = null;
private JButton jdestory = null;
private JButton jcancle = null;
/**
* @param owner
*/
public Dstory() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(486, 303);
this.setTitle("注销用户窗口");
this.setContentPane(getJContentPane());
this.setModal(true);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(40, 117, 66, 32));
jLabel1.setText("密码:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(40, 50, 66, 32));
jLabel.setText("卡号:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(getJdestorynum(), null);
jContentPane.add(getJdestoryPassword(), null);
jContentPane.add(getJdestory(), null);
jContentPane.add(getJcancle(), null);
}
return jContentPane;
}
/**
* This method initializes jdestorynum
*
* @return javax.swing.JTextField
*/
private JTextField getJdestorynum() {
if (jdestorynum == null) {
jdestorynum = new JTextField();
jdestorynum.setBounds(new Rectangle(156, 48, 136, 31));
}
return jdestorynum;
}
/**
* This method initializes jdestoryPassword
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJdestoryPassword() {
if (jdestoryPassword == null) {
jdestoryPassword = new JPasswordField();
jdestoryPassword.setBounds(new Rectangle(156, 114, 136, 31));
}
return jdestoryPassword;
}
/**
* This method initializes jdestory
*
* @return javax.swing.JButton
*/
private JButton getJdestory() {
if (jdestory == null) {
jdestory = new JButton();
jdestory.setBounds(new Rectangle(102, 203, 91, 33));
jdestory.setText("注销");
jdestory.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Qukuan qk=new Qukuan();
if(!Mainframe.numValid(jdestorynum.getText()))
{
JOptionPane.showMessageDialog(null, "请输入5位的数字卡号!");
}
else
{
if(qk.valid(jdestorynum.getText(),jdestoryPassword.getText()))
{//检查用户名和密码成功
int i=JOptionPane.showConfirmDialog(null,
"是否确认注销改用户", "提示", JOptionPane.YES_NO_OPTION);
if(JOptionPane.YES_OPTION == i){
//确认注销改用户
Statement stmt=null;
Connection conn=Sql.link();//连接数据库
try {
stmt=conn.createStatement();
stmt.execute("delete from 储户信息 where 账户号='"+jdestorynum.getText()+"'");
JOptionPane.showMessageDialog(null, "注销成功!");
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
} if(JOptionPane.NO_OPTION == i) {
}
}
else
{
JOptionPane.showMessageDialog(null, "账户不存在或用户密码错误!");
}
}//else
}
});
}
return jdestory;
}
/**
* This method initializes jcancle
*
* @return javax.swing.JButton
*/
private JButton getJcancle() {
if (jcancle == null) {
jcancle = new JButton();
jcancle.setBounds(new Rectangle(252, 203, 91, 33));
jcancle.setText("取消");
jcancle.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Dstory.this.dispose();
}
});
}
return jcancle;
}
} // @jve:decl-index=0:visual-constraint="179,50"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -