📄 delete.java
字号:
//删除用户的界面
package com.yanjun;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class delete extends JFrame{
JLabel L1=new JLabel("用户的名称");
JTextField txt=new JTextField(20);
JLabel L2=new JLabel("用户的密码");
JPasswordField pass1 = new JPasswordField(20);
String [] types={"学生","教师"};
JComboBox cb=new JComboBox();
JButton b1=new JButton("删除");
JButton b2=new JButton("取消");
ActionListener a1 = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String id1=txt.getText();
String id2=pass1.getText();
int num=cb.getSelectedIndex();
if(num==0)
{if(link.check1(id1,id2)){
if(deluser.del1(id1,id2))JOptionPane.showMessageDialog(null,
"你已经删除成功", "提示信息",
JOptionPane.ERROR_MESSAGE);
else JOptionPane.showMessageDialog(null,
"删除不成功", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
else JOptionPane.showMessageDialog(null,
"你输入的密码不符", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
if(num==1)
{if(link.check2(id1,id2)){
if(deluser.del2(id1,id2))JOptionPane.showMessageDialog(null,
"你已经删除成功", "提示信息",
JOptionPane.ERROR_MESSAGE);
else JOptionPane.showMessageDialog(null,
"删除不成功", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
else JOptionPane.showMessageDialog(null,
"你输入的密码不符", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
}
};
ActionListener a2 = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
dispose();
}
};
public delete()
{
super("删除用户");
Container cp=getContentPane();
cp.setLayout(new FlowLayout());
for(int i=0;i<types.length;i++)
cb.addItem(types[i]);
cp.add(L1);
cp.add(txt);
cp.add(L2);
cp.add(pass1);
cp.add(cb);
cp.add(b1);
cp.add(b2);
b1.addActionListener(a1);
b2.addActionListener(a2);
setSize(350,150);
show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -