91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 17KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2024-02-02
  • 語言: Java
  • 標(biāo)簽: 學(xué)生信息??

資源簡介

這是一個簡單的學(xué)生信息管理系統(tǒng),沒有連接數(shù)據(jù)庫 包括登錄界面和增刪該查修改界面

資源截圖

代碼片段和文件信息



登錄界面實現(xiàn)部分


import?java.awt.event.*;
import?javax.swing.*;
import?java.awt.*;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.WindowAdapter;
import?java.awt.event.WindowEvent;
import?java.io.BufferedReader;
import?java.io.File;
import?java.io.FileReader;
import?java.io.IOException;
import?java.util.*;
import?java.sql.*;
?
?class?Login?extends?Jframe??implements??ActionListener
{???Container?cp=null;
String?name=null;
String?psw=null;
???Jframe?f=null;
???JButton?j1j2;
???JTextField?t1;
???JPasswordField?t2;
???JLabel?jlable1jlable2;
????Color?c;
???JPanel?jp1jp2;
??????
Login(){
?
f=new?Jframe(“學(xué)生管理系統(tǒng)“);
j1=new?JButton(“確定“);
j2=new?JButton(“取消“);
cp=f.getContentPane();
jlable1=new?JLabel(“?輸入用戶名“);
jlable2=new?JLabel(“?用戶密碼“);
?
jp1=new?JPanel();
jp2=new?JPanel();
t1=new?JTextField(18);
t2=new?JPasswordField(18);

????????jp1.add(jlable1);
????????jp1.add(t1);
????????jp1.add(jlable2);
jp1.add(t2);
????????JLabel??JL=new?JLabel(“歡迎進(jìn)入學(xué)生管理系統(tǒng)“SwingConstants.CENTER);
????cp.add(JL“North“);
jp2.add(j1);
jp2.add(j2);
????cp.add(jp1“Center“);
????cp.add(“South“jp2);
jp1.setBackground(Color.lightGray);
???
Toolkit?kit=Toolkit.getDefaultToolkit();
Dimension?screen=kit.getScreenSize();
int?x=screen.width; /*取得顯示器窗口的寬度*/
int?y=screen.height; /*取得顯示器窗口的高度*/
//setSize(xy);?/*讓系統(tǒng)窗口平鋪整個顯示器窗口*/
?
? f.setSize(300300);
????int?xcenter=(x-300)/2;
????int?ycenter=(y-300)/2;
????f.setLocation(xcenterycenter);/*顯示在窗口中央*/
??
????f.setVisible(true);
???
????//----------------------------------------------------- ?
???????j1.addActionListener(this);//注冊事件監(jiān)聽器
???????j2.addActionListener(this);
???????f.addWindowListener(new?WindowAdapter(){
public?void?windowClosing(WindowEvent?e){
System.exit(0);
}
}
);
}
????public?void?confirm()?throws?IOException//驗證用戶和密碼是否存在
??{
File?file?=?new?File(“C://Login.txt“);
try?{
if(!file.exists())
file.createNewFile();
}?catch?(IOException?e)?{
e.printStackTrace();
}
BufferedReader?br?=?new?BufferedReader(new?FileReader(file));
String?temp=br.readLine();
String?line;
while((line=br.readLine())!=null){
temp+=““+line;
}
if(temp==null){
System.out.println();
}else{
///分割字符串
String[]?str=temp.split(““);
name=str[0];
psw=str[1];
if(t1.getText().trim().equals(name)&&t2.getText().trim().equals(psw)){
new?Test();
f.hide();
br.close();
}else{
JOptionPane.showMessageDialog(null“該用戶不存在““提示!“?
??????????JOptionPane.YES_NO_OPTION);

????}
????????
t1.setText(““);
t2.setText(““);
//for(int?i=0;i>str.length;i++){
//System.out.println(str[i]);
//}
}

???}
????public?void?actionPerformed(ActionEvent?e)
???????{
?String?cmd=e.getActionCommand();

評論

共有 條評論

相關(guān)資源