求大神帮忙能点清空按钮就让用户名和密码框中的数据清空
package 登录;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import javax.swing.*;
public class 登录{
public static void main(String[] args) {
登录 frame=new 登录();
frame.show();
}
public void show() {
JFrame frame=new JFrame();
frame.setTitle("登陆界面");
frame.setDefaultCloseOperation(3);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setLayout(new FlowLayout());
JLabel L1=new JLabel("账号:");
JTextField te1=new JTextField(12);
JLabel L2=new JLabel("密码:");
JPasswordField te2=new JPasswordField(12);
te2.setEchoChar('*');
JLabel L=new JLabel();
frame.add(L);
frame.add(L1);
frame.add(te1);
frame.add(L2);
frame.add(te2);
JCheckBox checkbox1=new JCheckBox("老师");
frame.add(checkbox1);
JCheckBox checkbox2=new JCheckBox("学生");
frame.add(checkbox2);
JButton B1=new JButton("登陆");
ButtonListener li1=new ButtonListener(te1,te2);
B1.addActionListener(li1);
frame.add(B1);
JButton B2=new JButton("清空");
frame.add(B2);
frame.setVisible(true);
JTextField jt=new JTextField("B2");
jt.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jt.setText("B2");
}
});
}
public class ButtonListener implements java.awt.event.ActionListener{
public JTextField te1=new JTextField();
public JPasswordField te2=new JPasswordField();
public ButtonListener(JTextField te1,JPasswordField te2) {
this.te1=te1;
this.te2=te2;
}
public void actionPerformed(ActionEvent e) {
String zhang=te1.getText();
String mi= String.valueOf(te2.getPassword());
if((zhang.equals("123456")==true)&&(mi.equals("111")==true)) {
}
else JOptionPane.showMessageDialog(null, "密码错误", null, 0);
}
}
}