📄 updatepwddialog.java
字号:
package mysiloer;
import java.awt.*;
import javax.swing.*;
import java.sql.Connection;
import javax.swing.border.Border;
import java.util.Vector;
import java.awt.event.ActionEvent;
/**
* <p>Title: MySiloer</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: yskey</p>
* @author 杨涛
* @version 1.0
*/
public class UpdatePwdDialog extends JDialog {
private JPanel panel1 = new JPanel();
private BorderLayout borderLayout1 = new BorderLayout();
private JPanel jPanel1 = new JPanel();
private JPanel jPanel2 = new JPanel();
private SiloPanel parentPanel;
private Connection con;
private Container cp;
private JPanel controlPanel = new JPanel();
private ButtonGroup group = new ButtonGroup();
private JRadioButton insertRadio = new JRadioButton();
private GridLayout gridLayout1 = new GridLayout();
private JRadioButton deleteRadio = new JRadioButton();
private JPanel contentPanel = new JPanel();
private JPanel buttonPanel = new JPanel();
private JButton okButton = new JButton();
private JButton cancelButton = new JButton();
private JLabel jLabel1 = new JLabel();
private FlowLayout flowLayout1 = new FlowLayout();
private Border border1;
private Vector namesVector;
private GridLayout gridLayout2 = new GridLayout();
private Border border2;
private static int INSERT = 1, DELETE = 0;
private int action = 2;
// private JTextField[] params = {new JTextField("", 10),
JTextField param1 = new JTextField("", 10);
JTextField param2 = new JTextField("", 10);
JTextField param3 = new JTextField("", 10);
JTextField param4 = new JTextField("", 10);
// new JTextField("", 10),
// new JTextField("", 10)
//};
// private JRadioButton updateRadio = new JRadioButton();
public UpdatePwdDialog(UserPanel frame, String title, boolean modal) {
super(new JFrame(), title, modal);
try {
jbInit();
this.setResizable(false);
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2 - 150);
// setVisible(true);
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public UpdatePwdDialog() {
this(null, "", true);
this.setResizable(false);
}
private void jbInit() throws Exception {
border1 = BorderFactory.createEmptyBorder(20,20,20,20);
border2 = BorderFactory.createEmptyBorder(5,10,5,10);
panel1.setLayout(borderLayout1);
cp = getContentPane();
contentPanel.removeAll();
this.gridLayout2.setColumns(2);
this.gridLayout2.setRows(4);
this.contentPanel.setLayout(gridLayout2);
JLabel lab = new JLabel("用 户 名:");
JLabel lab1 = new JLabel("旧 密 码:");
JLabel lab2 = new JLabel("新 密 码:");
JLabel lab3 = new JLabel("确认新密码:");
contentPanel.add(lab);
contentPanel.add(param1);
contentPanel.add(lab1);
contentPanel.add(param2);
contentPanel.add(lab2);
contentPanel.add(param3);
contentPanel.add(lab3);
contentPanel.add(param4);
validate();
pack();
repaint();
controlPanel.setLayout(gridLayout1);
// gridLayout1.setColumns(1);
gridLayout1.setHgap(5);
buttonPanel.setLayout(flowLayout1);
okButton.setText("确 定");
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
okButton_actionPerformed(e);
}
});
cancelButton.setText("取 消");
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
setVisible(false);
}
});
jLabel1.setText(" ");
controlPanel.setBorder(border1);
gridLayout2.setHgap(2);
gridLayout2.setVgap(5);
contentPanel.setLayout(gridLayout2);
gridLayout2.setColumns(2);
// gridLayout2.setRows(3);
contentPanel.setBorder(border2);
// updateRadio.setText("更新记录");
// updateRadio.addActionListener(new java.awt.event.ActionListener() {
// public void actionPerformed(ActionEvent e) {
// updateRadio_actionPerformed(e);
// }
// });
cp.add(panel1);
panel1.add(controlPanel, BorderLayout.NORTH);
// controlPanel.add(updateRadio, null);
controlPanel.add(insertRadio, null);
controlPanel.add(deleteRadio, null);
panel1.add(contentPanel, BorderLayout.CENTER);
panel1.add(buttonPanel, BorderLayout.SOUTH);
group.add(deleteRadio);
group.add(insertRadio);
// group.add(updateRadio);
buttonPanel.add(okButton, null);
buttonPanel.add(jLabel1, null);
buttonPanel.add(cancelButton, null);
}
private void okButton_actionPerformed(ActionEvent e){
if(this.action ==this.DELETE){
//删除用户的代码
}
else if(this.action == this.INSERT){
//添加用户的代码
}
}
// private void updateRadio_actionPerformed(ActionEvent e){
//
// }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -