📄 updatedialog.java
字号:
package com.sato.server.usermanager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.Border;
import com.sato.server.dao.db.DBConn;
public class UpdateDialog extends JDialog{
private JLabel idlabel=null;
private JLabel namelabel=null;
private JLabel passwordlabel=null;
private JLabel sexlabel=null;
private JLabel agelabel=null;
private JLabel addresslabel=null;
private JButton update=null;
private JButton cancel=null;
private JTextField idfield=null;
private JTextField namefield=null;
private JPasswordField passwordfield=null;
private JTextField addressfield=null;
private JComboBox sexcombox=null;
private JTextField agefield=null;
private Box totalbox=null;
private Box box1=null;
private Box box2=null;
private Box box3=null;
private Box box4=null;
private Box box5=null;
public UpdateDialog(UserJp ujp){
this.setModal(true);
this.setSize(300,200);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
idlabel=new JLabel("QQ号码:");
int selectrow=ujp.getJtableuser().getSelectedRow();
String id=ujp.getJtableuser().getValueAt(selectrow, 0).toString();
idfield=new JTextField(id);
idfield.setEditable(false);
namelabel=new JLabel("姓 名:");
passwordlabel=new JLabel("密 码:");
sexlabel=new JLabel("性 别:");
agelabel=new JLabel("年 龄:");
addresslabel=new JLabel("地 址:");
update=new JButton("更改");
cancel=new JButton("取消");
namefield=new JTextField();
passwordfield=new JPasswordField();
addressfield=new JTextField();
String[] str={"男","女"};
sexcombox=new JComboBox(str);
agefield=new JTextField();
Border bigbd=BorderFactory.createEmptyBorder(10, 10, 10, 10);
Border smallbd=BorderFactory.createEmptyBorder(3, 3, 3, 3);
totalbox=Box.createVerticalBox();
box1=Box.createHorizontalBox();
box2=Box.createHorizontalBox();
box3=Box.createHorizontalBox();
box4=Box.createHorizontalBox();
box5=Box.createHorizontalBox();
box1.add(idlabel);
box1.setBorder(smallbd);
box1.add(idfield);
box2.setBorder(smallbd);
box2.add(namelabel);
box2.add(namefield);
box2.add(passwordlabel);
box2.add(passwordfield);
box3.setBorder(smallbd);
box3.add(sexlabel);
box3.add(sexcombox);
box3.add(Box.createHorizontalStrut(45));
box3.add(agelabel);
box3.add(agefield);
box4.setBorder(smallbd);
box4.add(addresslabel);
box4.add(addressfield);
box5.add(update);
box5.add(Box.createHorizontalStrut(20));
box5.add(cancel);
totalbox.setBorder(bigbd);
totalbox.add(box1);
totalbox.add(box2);
totalbox.add(box3);
totalbox.add(box4);
totalbox.add(box5);
Updatelisten updatelisten=new Updatelisten(this,ujp);
update.addActionListener(updatelisten);
cancel.addActionListener(updatelisten);
this.add(totalbox);
this.setVisible(true);
}
public JButton getUpdate() {
return update;
}
public void setUpdate(JButton update) {
this.update = update;
}
public JButton getCancel() {
return cancel;
}
public void setCancel(JButton cancel) {
this.cancel = cancel;
}
public JTextField getNamefield() {
return namefield;
}
public void setNamefield(JTextField namefield) {
this.namefield = namefield;
}
public JTextField getPasswordfield() {
return passwordfield;
}
public void setPasswordfield(JPasswordField passwordfield) {
this.passwordfield = passwordfield;
}
public JTextField getAddressfield() {
return addressfield;
}
public void setAddressfield(JTextField addressfield) {
this.addressfield = addressfield;
}
public JComboBox getSexcombox() {
return sexcombox;
}
public void setSexcombox(JComboBox sexcombox) {
this.sexcombox = sexcombox;
}
public JTextField getAgefield() {
return agefield;
}
public void setAgefield(JTextField agefield) {
this.agefield = agefield;
}
public Box getTotalbox() {
return totalbox;
}
public void setTotalbox(Box totalbox) {
this.totalbox = totalbox;
}
public JTextField getIdfield() {
return idfield;
}
public void setIdfield(JTextField idfield) {
this.idfield = idfield;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -