📄 loading.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.*;
import com.yanjun.*;
public class loading extends JFrame
{
JLabel L1=new JLabel("名称");
JTextField txt=new JTextField(20);
JLabel L2=new JLabel("密码");
JPasswordField pass = new JPasswordField(20);
JButton b=new JButton("登陆");
JButton b2=new JButton("注册");
JButton b3=new JButton("退出");
String [] types={"学生","教师","管理员"};
JComboBox cb=new JComboBox();
ActionListener a1=new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String id1 = txt.getText();
String id2=pass.getText();
int id3=cb.getSelectedIndex();
dispose();
if(id3==0){
if(link.check1(id1,id2))new Menu1(id1,"student");//学生信息界面
else{
JOptionPane.showMessageDialog(null,
"你的密码无效", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
}
if(id3==1){
if(link.check2(id1,id2))new Menu2(id1,"teacher1");//教师信息界面
else{
JOptionPane.showMessageDialog(null,
"你的密码无效", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
}
if(id3==2){
if(link.check(id1,id2))new Menu3(id1,"Admin");//管理员界面
else{
JOptionPane.showMessageDialog(null,
"你的密码无效", "提示错误信息",
JOptionPane.ERROR_MESSAGE);
}
}
}
};
ActionListener a2 = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
new Regedit();
}
};
ActionListener a3 = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
};
loading()
{
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(pass);
cp.add(cb);
cp.add(b);
cp.add(b2);
cp.add(b3);
b.addActionListener(a1);
b2.addActionListener(a2);
b3.addActionListener(a3);
setSize(275,150);
show();
}
public static void main(String args[])
{
loading f=new loading();
WAdapter windowAdapter = new WAdapter();
f.addWindowListener(windowAdapter);
}
}
class WAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -