//此类是找回密码
package com.view;
import java.awt.Color;
/**
* 找回密码
* @author wu2xin
*
*/
/**
* 成员变量
*/
private static final long serialVersionUID = 1L;
private JLabel nameLab,alertLab,alertImg
;
/**
* new 出来新窗口
*/
public static void main
(String[] args
) {
InTo_Forget frame = new InTo_Forget();
frame.setVisible(true);
}
/**
* 构造初始化
*/
public InTo_Forget() {
setDefaultCloseOperation
(JFrame.
EXIT_ON_CLOSE);
this.setUndecorated(true);//去掉窗口的装饰
this.
getRootPane().
setWindowDecorationStyle(JRootPane.
PLAIN_DIALOG);////设置为简单对话窗口
this.setTitle("找回密码");
this.setSize(694, 498);
this.setLocationRelativeTo(null);
setContentPane(contentPane);
contentPane.setLayout(null);
alertImg.setBounds(0, 21, 60, 45);
contentPane.add(alertImg);
alertLab.
setFont(new Font("楷体",
Font.
BOLD,
20));
alertLab.setLocation(65, 21);
alertLab.setSize(113, 30);
contentPane.add(alertLab);
topImage.setBounds(376, 0, 307, 114);
contentPane.add(topImage);
/**
*操作 面板
*/
panel.setOpaque(false);//透明
tb.
setTitleFont(new Font("陈代明硬笔体",
Font.
PLAIN,
20));
tb.
setTitleColor(Color.
blue);
panel.setBorder(tb);//在Jpanel上打几个标题
panel.setBounds(0, 104, 684, 298);
contentPane.add(panel);
panel.setLayout(null);
nameCheck.setBounds(3, 33, 82, 30);
nameCheck.setOpaque(false);//透明
nameCheck.addActionListener(this);//监听1
panel.add(nameCheck);
emailCheck.setBounds(3, 105, 82, 30);
emailCheck.setOpaque(false);//透明
emailCheck.addActionListener(this);//监听1
panel.add(emailCheck);
nameLab.
setForeground(Color.
BLUE);
nameLab.
setFont(new Font("楷体",
Font.
BOLD,
16));
nameLab.setBounds(27, 69, 73, 30);
panel.add(nameLab);
nameTex.
setBackground(Color.
WHITE);
nameTex.setEditable(false);
nameTex.setBounds(110, 68, 123, 30);
panel.add(nameTex);
nameTex.setColumns(10);
emailLab.
setForeground(Color.
BLUE);
emailLab.
setFont(new Font("楷体",
Font.
BOLD,
16));
emailLab.setBounds(27, 141, 73, 30);
panel.add(emailLab);
emailTex.
setBackground(Color.
WHITE);
emailTex.setEditable(false);
emailTex.setColumns(10);
emailTex.setBounds(110, 141, 123, 30);
panel.add(emailTex);
lookBtu.setBounds(27, 226, 71, 30);
lookBtu.addActionListener(this);//监听1
panel.add(lookBtu);
delBut.setBounds(162, 226, 71, 30);
delBut.addActionListener(this);//监听1
panel.add(delBut);
scrollPane.setBounds(322, 44, 354, 231);
panel.add(scrollPane);
scrollPane.setViewportView(textArea);
alert.
setForeground(Color.
BLACK);
alert.
setFont(new Font("楷体",
Font.
PLAIN,
16));
alert.setBounds(263, 10, 82, 30);
panel.add(alert);
blackBut.setBounds(574, 412, 86, 30);
blackBut.addActionListener(this);//监听1
contentPane.add(blackBut);
topImg.setBounds(0, 0, 686, 498);
contentPane.add(topImg);
this.setVisible(true);//可见
}
/////////////////////////////////////////////////////////////注册监听器1(普通事件)
@Override
// TODO Auto-generated method stub
//String email=emailTex.getText();
AdminModel model=new AdminModel();
if(de.getSource()==nameCheck){//用户名单选
if(nameCheck.isSelected()){
nameTex.setEditable(true);
emailTex.setEditable(false);
emailCheck.setSelected(false);
}else{
nameTex.setEditable(false);
}
}else if(de.getSource()==emailCheck){//email 单选
if(emailCheck.isSelected()){
nameTex.setEditable(false);
nameCheck.setSelected(false);
emailTex.setEditable(true);
}
}else if(de.getSource()==lookBtu){//查询
if(StringUtil.isNotNull(id)){
AdminPoJo pojo
=model.
getAdmin(Integer.
parseInt(id
));
if(pojo!=null){
textArea.setText(id+",找回成功!\n\t"+pojo.getName()+"你好,你的密码是:"+pojo.getPassword());
}else{
textArea.setText("对不起,查找失败,没有"+id+"该账号");
}
}else{
}
}else if(de.getSource()==delBut){//撤销
nameTex.setText("");
emailTex.setText("");
textArea.setText("");
}else if(de.getSource()==blackBut){//返回登录主界面
new InTo();
this.dispose();
}
}
}