public void actionPerformed(ActionEvent e) {
if(txtname.getText().equals(""))
{
JOptionPane.showMessageDialog(getContentPane(), "用户名不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);
}
else{
Users u=new Users();
UserDAO usdo=new UserDAO();
u=usdo.findUser(txtname.getText(), txtpassword.getText());
if(u!=null){
JOptionPane.showMessageDialog(getContentPane(), "该用户存在!","提示信息框",JOptionPane.WARNING_MESSAGE);
}
else{
JOptionPane.showMessageDialog(getContentPane(), "该用户不存在!","提示信息框",JOptionPane.WARNING_MESSAGE);
}
}
}
});
btnfind.setBounds(427, 205, 113, 27);
contentPane.add(btnfind);
//记得要写这个
setVisible(true);
}
}
如何用Java语言编写学生成绩管理系统package student;
import java.util.Scanner;
public class teststudent {
public static void main(String args[]){
System.out.println("************************学生成绩管理系统*********************");
System.out.println("请输入要管理的学生人数:");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
studentMassage stum = new studentMassage(n);
int flag = 1;
while(flag == 1){
System.out.println("1.输入学生信息");
System.out.println("2.通过姓名查找学生信息");
System.out.println("3.显示全部学生信息");
System.out.println("4.退出系统");
int op = sc.nextInt();
switch(op){
case 1:stum.addStudent(n);
new Scanner(System.in).nextLine();
break;
case 2:
System.out.println("输入学生姓名:");
String name =sc.next();
stum.FindStudent(name);
new Scanner(System.in).nextLine();
break;
case 3:
stum.showallStudent();
new Scanner(System.in).nextLine();
break;
case 4:
flag = 0;
System.out.println("已退出系统!");
break;
default:
System.out.println("输入有误!");
new Scanner(System.in).nextLine();
}
}
}
}
class Date{
int year;
int month;
int day;
/*public Date(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
public Date(){}*/
public String showDate(){
return year + "/"+ month+"/"+day;
}
}
class student{
int id;
String name;
Date date;
float score;
public student(){
id = 0;
name = null;
date = null;
score = 0f;
}
public void showStudent(){
System.out.println( id + " " + name + " "+ " " + date.showDate()+" "+score);
}
}
class studentMassage{
private student[] stu;
private int flag;
public studentMassage(int n){
flag = 0;
if(stu == null){
stu = new student[n];
for(int i =0;in;++i){
stu[i] = new student();
}
}
}
public void addStudent(int n){
flag = 1;
Scanner sc = new Scanner(System.in);
System.out.println("请输入"+n+"个学生信息");
for(int i = 0 ;istu.length;++i){
stu[i].date = new Date();
System.out.println("请输入第"+(i+1)+"个学生学号:");
stu[i].id = sc.nextInt();
System.out.println("请输入第"+(i+1)+"个学生姓名:");
stu[i].name = sc.next();
System.out.println("请输入第"+(i+1)+"个学生出生年份:");
stu[i].date.year = sc.nextInt();
System.out.println("请输入第"+(i+1)+"个学生出生月份:");
stu[i].date.month = sc.nextInt();
System.out.println("请输入第"+(i+1)+"个学生出生日期:");
stu[i].date.day = sc.nextInt();
//stu[i].date = new Date(year,month,day);
System.out.println("请输入第"+(i+1)+"个学生分数:");
推荐阅读
- 直播都有什么程序流量,直播需要的流量
- 鸿蒙系统网速显示在哪里,鸿蒙系统测网速在哪
- 青岛每日优购小程序开发,青岛每日优购小程序开发怎么样
- 坦克类单机游戏苹果的简单介绍
- python正切余切函数 python 余切函数
- php7.1数据库连接,php数据库怎么连接
- 怎么判断显卡偷没偷懒,怎么判断显卡是否有问题
- 如何开展电商招商,电商项目招商
- c语言正数变为负数函数 c++正数变负数