网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

java学生管理系统代码 java学生管理系统代码流程图

基于java设计一个学生成绩管理系统,要求有界面,且有增加,查询,修改,删除,退出功能,代码如何写?

import java.awt.Color;

成都创新互联公司主要从事做网站、成都网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务道里,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792

import java.awt.Font;

import java.awt.Frame;

import java.awt.Label;

import java.awt.TextField;

import java.awt.Window;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import java.sql.SQLException;

import javax.swing.JButton;

public class Stmessege {

Font font = new Font("楷体", Font.BOLD, 18);

private Frame m = new Frame("登陆成功界面");

protected Window f;

public Stmessege() {

m.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent evt) {

m.setVisible(false);

m.dispose();

System.exit(0);

}

});

m.setSize(460, 360);

m.setBackground(Color.green);

m.setLayout(null);

m.setLocationRelativeTo(null);

Label l0 = new Label("管理员信息");

Font font1 = new Font("楷体", Font.BOLD, 32);

l0.setForeground(Color.blue);

l0.setSize(180, 50);

l0.setLocation(150, 30);

l0.setFont(font1);

final Label l1 = new Label("姓名:");

l1.setSize(60, 20);

l1.setLocation(10, 100);

l1.setFont(font);

TextField tf1 = new TextField("黄朋");

tf1.setForeground(Color.blue);

tf1.setBackground(Color.white);

tf1.setSize(50, 20);

tf1.setLocation(70, 100);

final Label l2 = new Label("学号:");

l2.setSize(60, 20);

l2.setLocation(140, 100);

l2.setFont(font);

TextField tf2 = new TextField("111265");

tf2.setForeground(Color.blue);

tf2.setBackground(Color.white);

tf2.setSize(60, 20);

tf2.setLocation(190, 100);

final Label l3 = new Label("性别:");

l3.setSize(60, 20);

l3.setLocation(280, 100);

l3.setFont(font);

TextField tf3 = new TextField("男");

tf3.setForeground(Color.blue);

tf3.setBackground(Color.white);

tf3.setSize(40, 20);

tf3.setLocation(360, 100);

final Label l4 = new Label("班级:");

l4.setSize(60, 20);

l4.setLocation(10, 170);

l4.setFont(font);

TextField tf4 = new TextField("611231");

tf4.setForeground(Color.blue);

tf4.setBackground(Color.white);

tf4.setSize(60, 20);

tf4.setLocation(67, 170);

final Label l5 = new Label("系别:");

l5.setSize(60, 20);

l5.setLocation(140, 170);

l5.setFont(font);

TextField tf5 = new TextField("计算机工程系");

tf5.setForeground(Color.blue);

tf5.setBackground(Color.white);

tf5.setSize(80, 20);

tf5.setLocation(200, 170);

final Label l6 = new Label("成绩:");

l6.setSize(60, 20);

l6.setLocation(280, 170);

l6.setFont(font);

TextField tf6 = new TextField("95");

tf6.setForeground(Color.blue);

tf6.setBackground(Color.white);

tf6.setSize(40, 20);

tf6.setLocation(360, 170);

final Label l7 = new Label("专业:");

l7.setSize(60, 20);

l7.setLocation(10, 230);

l7.setFont(font);

TextField tf7 = new TextField("软件技术");

tf7.setForeground(Color.blue);

tf7.setBackground(Color.white);

tf7.setSize(60, 20);

tf7.setLocation(70, 230);

JButton btn1 = new JButton("添加");

btn1.setForeground(Color.blue);

btn1.setSize(80, 38);

btn1.setLocation(35, 300);

btn1.setFont(font);

btn1.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

new 插入();

m.setVisible(true);

}

});

JButton btn2 = new JButton("查询学生学籍信息");

btn2.setForeground(Color.blue);

btn2.setSize(200, 38);

btn2.setLocation(135, 300);

btn2.setFont(font);

btn2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

Stmessege1 f;

try {

f = new Stmessege1();

f.Stmessege11();

m.setVisible(true);

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (ClassNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

});

JButton btn3 = new JButton("删除");

btn3.setForeground(Color.blue);

btn3.setSize(80, 38);

btn3.setLocation(350, 300);

btn3.setFont(font);

btn3.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

new 删除();

//f.setVisible(false);

m.setVisible(true);

}

});

JButton btn4 = new JButton("更新");

btn4.setForeground(Color.blue);

btn4.setSize(80, 38);

btn4.setLocation(200, 230);

btn4.setFont(font);

btn4.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

new 更新();

m.setVisible(true);

}

});

m.add(l0);

m.add(l1);

m.add(tf1);

m.add(l2);

m.add(tf2);

m.add(l3);

m.add(tf3);

m.add(l4);

m.add(tf4);

m.add(l5);

m.add(tf5);

m.add(l6);

m.add(tf6);

m.add(l7);

m.add(tf7);

m.add(btn1);

m.add(btn2);

m.add(btn3);

m.add(btn4);

m.setVisible(true);

}

public static void main(String[] args) {

new Stmessege();

}

}

可以仿照我的做一下,希望采纳,我才一级哦

怎么用java做一个简单的学生管理系统?

用java写的话,可以用List来实现学生管理系统:\x0d\x0a首先,管理系统是针对学生对象的,所以我们先把学生对象就写出来:\x0d\x0apackage bean;\x0d\x0apublic class Student {\x0d\x0a String name;\x0d\x0a String studentId;\x0d\x0a String sex;\x0d\x0a int grade;\x0d\x0a public Student(String name,String studentId,String sex,int grade){\x0d\x0a this.name= name;\x0d\x0a this.studentId= studentId;\x0d\x0a this.sex = sex;\x0d\x0a this.grade = grade; \x0d\x0a }\x0d\x0a public int getGrade(){\x0d\x0a return grade;\x0d\x0a }\x0d\x0a public String getName(){\x0d\x0a return name;\x0d\x0a }\x0d\x0a public String getSex(){\x0d\x0a return sex;\x0d\x0a }\x0d\x0a public void setGrade(int g){\x0d\x0a this.grade = g;\x0d\x0a }\x0d\x0a public String getStudentId(){\x0d\x0a return studentId;\x0d\x0a }\x0d\x0a}\x0d\x0a这里面定义了一些得到当前学生对象数据的一些get方法,和成绩修改的set方法,代码很简单,就不做详细的解答。\x0d\x0a就下来就是我们的正文了。\x0d\x0a虽然我们暂时不用swing来做界面,但是总得要看的过去吧,所以,先做了一个比较简单的界面:\x0d\x0a System.out.println("***************");\x0d\x0a System.out.println("*欢迎来到学生管理系统 *");\x0d\x0a System.out.println("*1:增加学生 *");\x0d\x0a System.out.println("*2:删除学生 *");\x0d\x0a System.out.println("*3:修改成绩 *");\x0d\x0a System.out.println("*4:查询成绩 *");\x0d\x0a System.out.println("***************");\x0d\x0a System.out.println("您想选择的操作是:");\x0d\x0a这里可以看到,我们的是用一个1234来选择项目,说以不得不讲一下Java如何获取到键盘所输入的数据---------Scanner ,要使用这个,首先需要import进来一个包:\x0d\x0a例如这里:\x0d\x0aimport java.util.*;\x0d\x0a之后的两行代码搞定输入:\x0d\x0aScanner sc = new Scanner(System.in);\x0d\x0a int choice = sc.nextInt();\x0d\x0a接下来就是各个功能的实现:\x0d\x0a\x0d\x0apackage test;\x0d\x0aimport java.util.*;\x0d\x0aimport bean.Student;\x0d\x0apublic class Manager {\x0d\x0a static List StudentList = new LinkedList();\x0d\x0a public static void main(String[] agrs){\x0d\x0a select(StudentList); \x0d\x0a }\x0d\x0a private static void select(List StudentList ){\x0d\x0a System.out.println("***************");\x0d\x0a System.out.println("*欢迎来到学生管理系统 *");\x0d\x0a System.out.println("*1:增加学生 *");\x0d\x0a System.out.println("*2:删除学生 *");\x0d\x0a System.out.println("*3:修改成绩 *");\x0d\x0a System.out.println("*4:查询成绩 *");\x0d\x0a System.out.println("***************");\x0d\x0a System.out.println("您想选择的操作是:");\x0d\x0a Scanner sc = new Scanner(System.in);\x0d\x0a int choice = sc.nextInt(); \x0d\x0a switch(choice){\x0d\x0a //增加学生\x0d\x0a case 1:\x0d\x0a System.out.print("请输入学生的姓名:");\x0d\x0a Scanner Sname = new Scanner(System.in);\x0d\x0a String name = Sname.nextLine();\x0d\x0a System.out.print("请输入学生的性别:");\x0d\x0a Scanner Ssex = new Scanner(System.in);\x0d\x0a String sex = Ssex.nextLine();\x0d\x0a System.out.print("请输入学生的学号:");\x0d\x0a Scanner SId = new Scanner(System.in);\x0d\x0a String studentId = SId.nextLine();\x0d\x0a System.out.print("请输入学生的成绩:");\x0d\x0a Scanner Sgrade = new Scanner(System.in);\x0d\x0a int grade = Sgrade.nextInt();\x0d\x0a StudentList.add(new Student(name,studentId,sex,grade));\x0d\x0a System.out.println("添加成功!!!!!");\x0d\x0a select(StudentList);\x0d\x0a break;\x0d\x0a //删除学生成绩\x0d\x0a case 2:\x0d\x0a System.out.print("请告诉我需要删除学生的学号:");\x0d\x0a Scanner Sid = new Scanner(System.in);\x0d\x0a String SstudentId = Sid.nextLine();\x0d\x0a boolean isfindDelete = false;\x0d\x0a for (int i = 0; i

回答于 2022-11-16

求java中类似学生信息管理系统中按学号,按姓名排序的代码

import java.util.ArrayList;

import java.util.Collections;

import java.util.Comparator;

import java.util.List;

public class Sort {

public static void main(String[] args) {

Student p1 = new Student(1001, "小明", 20);

Student p2 = new Student(1002, "小红", 21);

Student p3 = new Student(1003, "小黑", 19);

ListStudent list = new ArrayListStudent();

list.add(p1);

list.add(p2);

list.add(p3);

Collections.sort(list, new ComparatorStudent() {

/*

 * int compare(Student o1, Student o2) 返回一个基本类型的整型, 返回负数表示:o1 小于o2,

 * 返回0 表示:o1和o2相等, 返回正数表示:o1大于o2。

 */

public int compare(Student o1, Student o2) {

// 按照学生的学号进行升序排列

if (o1.getId()  o2.getId()) {

return 1;

}

if (o1.getId() == o2.getId()) {

return 0;

}

return -1;

}

});

write(list);

System.out.println("---------------------");

Collections.sort(list, new ComparatorStudent() {

/*

 * int compare(Student o1, Student o2) 返回一个基本类型的整型, 返回负数表示:o1 小于o2,

 * 返回0 表示:o1和o2相等, 返回正数表示:o1大于o2。

 */

public int compare(Student o1, Student o2) {

// 按照学生的年龄进行升序排列

if (o1.getAge()  o2.getAge()) {

return 1;

}

if (o1.getAge() == o2.getAge()) {

return 0;

}

return -1;

}

});

write(list);

}

public static void write(ListStudent list) {

for (Student s : list) {

System.out.println(s.getId() + "\t" + s.getName() + "\t"

+ s.getAge());

}

}

}

public class Student {

private int id ;

private String name;

private int age;

//构造方法

public Student(int id,String name,int age){

this.id = id;

this.name = name;

this.age = age;

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

}

求用Java编写的学生成绩管理系统的完整代码,要能运行的

以下方法实现了用户界面登陆

import java.awt.*;

import java.awt.event.*;

public class DengLuJieMian extends Frame implements ActionListener

{

Label username=new Label("用户名:");//使用文本创建一个用户名标签

TextField t1=new TextField();//创建一个文本框对象

Label password=new Label("密码:");//创建一个密码标签

TextField t2=new TextField();

Button b1=new Button("登陆");//创建登陆按钮

Button b2=new Button("取消");//创建取消按钮

public DengLuJieMian()

{

this.setTitle("学生信息管理系统");//设置窗口标题

this.setLayout(null);//设置窗口布局管理器

username.setBounds(50,40,60,20);//设置姓名标签的初始位置

this.add(username);// 将姓名标签组件添加到容器

t1.setBounds(120,40,80,20);// 设置文本框的初始位置

this.add(t1);// 将文本框组件添加到容器

password.setBounds(50,100,60,20);//密码标签的初始位置

this.add(password);//将密码标签组件添加到容器

t2.setBounds(120,100,80,20);//设置密码标签的初始位置

this.add(t2);//将密码标签组件添加到容器

b1.setBounds(50,150,60,20);//设置登陆按钮的初始位置

this.add(b1);//将登陆按钮组件添加到容器

b2.setBounds(120,150,60,20);//设置取消按钮的初始位置

this.add(b2);// 将取消按钮组件添加到容器

b1.addActionListener(this);//给登陆按钮添加监听器

b2.addActionListener(this);// 给取消按钮添加监听器

this.setVisible(true);//设置窗口的可见性

this.setSize(300,200);//设置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

});//通过内部类重写关闭窗体的方法

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b1)//处理登陆事件

{

String name=t1.getText();

String pass=t2.getText();

if(name!=nullpass.equals("000123"))//判断语句

{

new StudentJieMian();

}

}

}

public static void main(String args[])//主函数

{

new DengLuJieMian();

}

}

以下方法实现了学生界面设计

import java.awt.*;

import java.awt.event.*;

class StudentJieMian extends Frame implements ActionListener

{

MenuBar m=new MenuBar();//创建菜单栏

Menu m1=new Menu("信息");//创建菜单“信息”

MenuItem m11=new MenuItem("插入");//创建“插入”的菜单项

MenuItem m12=new MenuItem("查询");

Menu m2=new Menu("成绩");//创建菜单“成绩”

MenuItem m21=new MenuItem("查询");

public StudentJieMian()

{

this.setTitle("学生界面");//设置窗口标题

this.setLayout(new CardLayout());//设置窗口布局管理器

this.setMenuBar(m);//将菜单栏组件添加到容器

m.add(m1);//将信息菜单放入菜单栏

m.add(m2);

m1.add(m11);//将“插入”菜单项添加到“信息”菜单

m1.add(m12); //将“查询”菜单项添加到“信息”菜单

m2.add(m21); //将“查询”菜单项添加到“成绩”菜单

m11.addActionListener(this); //给“插入”菜单项添加监听器

m12.addActionListener(this); //给“查询”菜单项添加监听器

m21.addActionListener(this); //给“查询”菜单项添加监听器

this.setVisible(true); //设置窗口的可见性

this.setSize(300,200); //设置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);//关闭窗口

}

});

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==m11) //处理“添加信息”事件

{

new AddStudent();

}

if(e.getSource()==m12) //处理“查询信息”事件

{

new SelectStudent();

}

if(e.getSource()==m21) //处理“查询成绩”事件

{

new ChengJiStudent();

}

}

public static void main(String args[])

{ new StudentJieMian(); //创建一个对象 }


文章题目:java学生管理系统代码 java学生管理系统代码流程图
网站链接:http://bjjierui.cn/article/dojohgj.html

其他资讯