📄 updateuserinfo.java
字号:
return;
}
}
if(teltextField.getText().length()<7||teltextField.getText().length()>12)
{
JOptionPane.showMessageDialog(frame,"电话输入的不对,请确认是在7-12的数字!","警告",JOptionPane.WARNING_MESSAGE,null);
return;
}
if((!(Check.includeChar(emailField.getText(),'@')))||emailField.getText().length()==0)
{
JOptionPane.showMessageDialog(frame,"E_mail输入的格式不正确!","警告",JOptionPane.WARNING_MESSAGE,null);
return;
}
if(yearField.getText().length()==0)
{
JOptionPane.showMessageDialog(frame,"日期不能为空!","警告",JOptionPane.WARNING_MESSAGE,null);
return;
}else
{
if(!(Check.checkMsg(yearField.getText(),8,10,false)))
{
JOptionPane.showMessageDialog(frame,"日期格式不对,年-月-日!","警告",JOptionPane.WARNING_MESSAGE,null);
yearField.setText("");
return;
}
}
if(!(Check.checkMsg(textArea.getText(), 0, 30, false)))
{
JOptionPane.showMessageDialog(frame,"备注超过长度!","警告",JOptionPane.WARNING_MESSAGE,null);
return;
}
String sex="";
if(men.isSelected())
sex="男";
sex="女";
try {
ToServerProcess.oos.writeObject("修改用户信息:"+idField.getText()+":"+nametextField.getText()+":"+postiontextField.getText()+":"+sex+":"+yearField.getText()+":"+teltextField.getText()+":"+emailField.getText()+":"+headpic+":"+textArea.getText());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
update.setText("修改");
update.setBounds(87, 346, 88, 25);
frame.getContentPane().add(update);
final JButton button_2 = new JButton();
button_2.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
frame.dispose();
}
});
button_2.setText("关闭");
button_2.setBounds(188, 346, 83, 25);
frame.getContentPane().add(button_2);
final JButton button_3 = new JButton();
button_3.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
panel.setVisible(true);
}
});
button_3.addMouseListener(new MouseAdapter() {
public void mouseEntered(final MouseEvent e) {
button_3.setIcon(SwingResourceManager.getIcon(ShowUserInfoGUI.class, "/edu/sccp/chat/image/0.gif"));
}
public void mouseExited(final MouseEvent e) {
button_3.setIcon(SwingResourceManager.getIcon(ShowUserInfoGUI.class, "/edu/sccp/chat/image/h7.gif"));
}
});
button_3.setIcon(SwingResourceManager.getIcon(ShowUserInfoGUI.class, "/edu/sccp/chat/image/h7.gif"));
button_3.setBounds(322, 22, 12, 25);
frame.getContentPane().add(button_3);
panel = new JPanel();
panel.setLayout(new GridLayout(0, 1));
panel.setBounds(280, 47, 45, 318);
panel.setVisible(false);
frame.getContentPane().add(panel);
final JButton button_4 = new JButton();
button_4.setIcon(SwingResourceManager.getIcon(ShowUserInfoGUI.class, "/edu/sccp/chat/image/t1.png"));
button_4.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_4.getIcon());
panel.setVisible(false);
}
});
panel.add(button_4);
final JButton button_5 = new JButton();
button_5.setIcon(SwingResourceManager.getIcon(ShowUserInfoGUI.class, "/edu/sccp/chat/image/t2.png"));
button_5.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_5.getIcon());
panel.setVisible(false);
}
});
panel.add(button_5);
final JButton button_6 = new JButton();
button_6.setIcon(SwingResourceManager.getIcon(ShowUserInfoGUI.class, "/edu/sccp/chat/image/t3.png"));
button_6.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_6.getIcon());
panel.setVisible(false);
}
});
panel.add(button_6);
final JButton button_7 = new JButton();
button_7.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_7.getIcon());
url="/edu/sccp/chat/image/t7.png";
panel.setVisible(false);
}
});
button_7.setIcon(SwingResourceManager.getIcon(UpdateUserInfo.class, "/edu/sccp/chat/image/t7.png"));
panel.add(button_7);
final JButton button_8 = new JButton();
button_8.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_8.getIcon());
url="/edu/sccp/chat/image/t4.png";
panel.setVisible(false);
}
});
button_8.setIcon(SwingResourceManager.getIcon(UpdateUserInfo.class, "/edu/sccp/chat/image/t4.png"));
panel.add(button_8);
final JButton button_9 = new JButton();
button_9.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_9.getIcon());
url="/edu/sccp/chat/image/t5.png";
panel.setVisible(false);
}
});
button_9.setIcon(SwingResourceManager.getIcon(UpdateUserInfo.class, "/edu/sccp/chat/image/t5.png"));
panel.add(button_9);
final JButton button_10 = new JButton();
button_10.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_10.getIcon());
url="/edu/sccp/chat/image/t6.png";
panel.setVisible(false);
}
});
button_10.setIcon(SwingResourceManager.getIcon(UpdateUserInfo.class, "/edu/sccp/chat/image/t6.png"));
panel.add(button_10);
final JButton button_11 = new JButton();
button_11.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
head.setIcon(button_11.getIcon());
url="/edu/sccp/chat/image/t8.png";
panel.setVisible(false);
}
});
button_11.setIcon(SwingResourceManager.getIcon(UpdateUserInfo.class, "/edu/sccp/chat/image/t8.png"));
panel.add(button_11);
comboBox = new JComboBox();
comboBox.addItem("人事部门");
comboBox.addItem("财务部门");
comboBox.addItem("公关部门");
comboBox.addItem("管理部门");
comboBox.addItem("销售部门");
comboBox.setBounds(69, 90, 118, 20);
frame.getContentPane().add(comboBox);
final JLabel label_9 = new JLabel();
label_9.setText("输完敲回车");
label_9.setBounds(206, 10, 73, 16);
frame.getContentPane().add(label_9);
label_10 = new JLabel();
label_10.setForeground(new Color(255, 0, 0));
label_10.setBounds(206, 33, 60, 15);
frame.getContentPane().add(label_10);
final JLabel label_7 = new JLabel();
label_7.setText("职务:");
label_7.setBounds(30, 127, 60, 15);
frame.getContentPane().add(label_7);
postiontextField = new JTextField();
postiontextField.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
if(postiontextField.getText().length()==0)
{
label_8.setText("保持在5个字之内");
}else
{
label_8.setText("");
}
}
public void focusLost(final FocusEvent e) {
if(postiontextField.getText().length()==0)
{
label_8.setText("不能为空");
}else
{
label_8.setText("");
}
}
});
postiontextField.setBounds(69, 122, 131, 20);
frame.getContentPane().add(postiontextField);
JLabel label_8 = new JLabel();
label_8.setForeground(new Color(255, 0, 0));
label_8.setBounds(211, 127, 60, 15);
frame.getContentPane().add(label_8);
label_14 = new JLabel();
label_14.setForeground(new Color(255, 0, 0));
label_14.setBounds(211, 149, 60, 15);
frame.getContentPane().add(label_14);
label_11 = new JLabel();
label_11.setForeground(new Color(255, 0, 0));
label_11.setBounds(206, 209, 97, 16);
frame.getContentPane().add(label_11);
}
public void showGUI()
{
frame.setResizable(false);
frame.setSize(354,407);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new UpdateUserInfo().showGUI();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -