189 8069 5689

教务系统的java代码,教务系统编程

300分急求教务选课系统的JAVA代码。

import java.awt.*;

成都创新互联是一家集网站建设,王屋企业网站建设,王屋品牌网站建设,网站定制,王屋网站建设报价,网络营销,网络优化,王屋网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

import java.awt.event.*;

import java.util.*;

class p1 extends Panel

{

Label l1;

Font f=new Font("宋体",Font.BOLD,20);

p1()

{

setLayout(new GridLayout(1,1));

l1=new Label("网上选课记录系统",Label.CENTER);

l1.setFont(f);

add(l1);

}

}

class p2 extends Panel

{

Label l1,l2;

TextField t1,t2;

p2()

{

setLayout(new GridLayout(1,4));

l1=new Label("姓名",Label.CENTER);

l2=new Label("学号",Label.CENTER);

t1=new TextField(10);

t2=new TextField(10);

add(l1);

add(t1);

add(l2);

add(t2);

}

}

class p3 extends Panel

{

Label l1,l2;

TextField t1,t2;

p3()

{

setLayout(new GridLayout(1,4));

l1=new Label("专业",Label.CENTER);

l2=new Label("所属院(系)",Label.CENTER);

t1=new TextField(10);

t2=new TextField(10);

add(l1);

add(t1);

add(l2);

add(t2);

}

}

class p4 extends Panel

{

Label l1;

Button btn1;

Button btn2;

Button btn3;

Font f=new Font("宋体",Font.BOLD,20);

p4()

{

setLayout(new GridLayout(1,4));

l1=new Label("请选择您要选修的课程并确认",Label.CENTER);

btn1=new Button("查询");

btn2=new Button("确认");

btn3=new Button("退出系统");

add(l1);

add(btn1);

add(btn2);

add(btn3);

}

}

class p5 extends Panel

{

List list ;

p5()

{

setLayout(new GridLayout(1,1));

list=new List(8,true);

list.add("大学英语");

list.add("计算机图形学");

list.add("JAVA语言");

list.add("高等数学");

list.add("数据结构");

list.add("单片机");

list.add("网络应用与开发");

list.add("概率论与数理统计");

list.add("管理学概论");

list.add("数据库概论");

list.add("英语听力");

list.add("VC++");

list.add("商务英语");

list.add("会计学");

list.add("经济学");

list.add("计算机网络");

add(list);

}

}

class p6 extends Panel

{

TextArea ta;

p6()

{

setLayout(new GridLayout(1,1));

ta=new TextArea(8,30);

add(ta);

}

}

class p8 extends Panel

{

Label l1,l2,l3;

Label l4,l5,l6,l7,l9;

Panel p11,p22,p33,p44,p55;

TextField t1,t2;

Button btn;

p8()

{

p11=new Panel();

p22=new Panel();

p33=new Panel();

p44=new Panel();

p55=new Panel();

p11.setLayout(new GridLayout(1,1));

p22.setLayout(new GridLayout(1,1));

p33.setLayout(new GridLayout(1,4));

p44.setLayout(new GridLayout(1,4));

p55.setLayout(new GridLayout(1,1));

l4=new Label("");

l5=new Label("");

l6=new Label("");

l7=new Label("");

l9=new Label("");

l1=new Label("欢迎来到网上选课系统",Label.CENTER);

Font f=new Font("宋体",Font.BOLD,30);

l1.setFont(f);

l2=new Label("请输入管理员帐号",Label.CENTER);

l3=new Label("请输入管理员密码",Label.CENTER);

setBackground(Color.lightGray);

btn=new Button("确定");

t1=new TextField(20);

t2=new TextField(15);

t2.setEchoChar(´*´);

l1.setForeground(Color.magenta);

t1.setBackground(Color.cyan);

t2.setBackground(Color.cyan);

t1.setForeground(Color.red);

t2.setForeground(Color.red);

l2.setForeground(Color.blue);

l3.setForeground(Color.blue);

p11.add(l1);

p22.add(l4);

p33.add(l5);

p33.add(l2);

p33.add(t1);

p33.add(l6);

p44.add(l7);

p44.add(l3);

p44.add(t2);

p44.add(btn);

p55.add(l9);

setLayout(new GridLayout(5,1));

add(p11);

add(p22);

add(p33);

add(p44);

add(p55);

}

}

class p9 extends Panel

{

p1 pn1=new p1();

p2 pn2=new p2();

p3 pn3=new p3();

p4 pn4=new p4();

p5 pn5=new p5();

p6 pn6=new p6();

p9()

{

setLayout(new GridLayout(6,1));

add(pn1);

add(pn2);

add(pn3);

add(pn4);

add(pn5);

add(pn6);

}

}

class user

{

String username;

String sd;

String major;

String institute;

String course;

user(String x1,String x2,String x3,String x4,String x5)

{

username=x1;

sd=x2;

major=x3;

institute=x4;

course=x5;

}

}

public class www

{

public static void main(String args[])

{

new m();

}

}

class m extends Frame implements ActionListener,ItemListener

{

StringBuffer ss=new StringBuffer("您好!您选修的课程有:");

Vector xiang=new Vector();

p9 pn9;

p8 pn8;

CardLayout cc=new CardLayout();

Button btn1;

Dialog d1;

m()

{

super("网上选课");

pn8=new p8();

pn9=new p9();

setLayout(cc);

add("one",pn8);

add("two",pn9);

btn1=new Button("确定");

pn9.pn1.l1.setBackground(Color.pink);

pn9.pn1.l1.setForeground(Color.blue);

pn9.pn2.l1.setBackground(Color.gray);

pn9.pn2.l1.setForeground(Color.orange);

pn9.pn2.l2.setBackground(Color.gray);

pn9.pn2.l2.setForeground(Color.orange);

pn9.pn3.l1.setBackground(Color.gray);

pn9.pn3.l1.setForeground(Color.orange);

pn9.pn3.l2.setBackground(Color.gray);

pn9.pn3.l2.setForeground(Color.orange);

pn9.pn2.t1.setForeground(Color.red);

pn9.pn2.t1.setBackground(Color.cyan);

pn9.pn2.t2.setForeground(Color.red);

pn9.pn2.t2.setBackground(Color.cyan);

pn9.pn3.t1.setForeground(Color.red);

pn9.pn3.t1.setBackground(Color.cyan);

pn9.pn3.t2.setForeground(Color.red);

pn9.pn3.t2.setBackground(Color.cyan);

pn9.pn5.list.setBackground(Color.pink);

pn9.pn5.list.setForeground(Color.blue);

pn9.pn6.ta.setBackground(Color.blue);

pn9.pn6.ta.setForeground(Color.white);

pn9.pn4.btn1.addActionListener(this);

pn9.pn4.btn2.addActionListener(this);

pn9.pn4.btn3.addActionListener(this);

pn9.pn5.list.addActionListener(this);

(pn9.pn5.list).addItemListener(this);

pn8.btn.addActionListener(this);

btn1.addActionListener(this);

setSize(650,400);

show();

}

public void actionPerformed(ActionEvent e)

{

xiang.addElement(new user("马先生","23597483","计算机","计算机系","单片机,数学"));

xiang.addElement(new user("杨先生","7899452","计算机","计算机系","单片机,数学"));

xiang.addElement(new user("董先生","7899452","计算机","计算机系","单片机,数学"));

xiang.addElement(new user("何先生","7899453","计算机","计算机系","单片机,数学"));

if(e.getSource()==pn8.btn)

{

String ss="123";

if(ss.compareTo(pn8.t1.getText())==0ss.compareTo(pn8.t2.getText())==0)

cc.show(this,"two");

else

{

d1=new Dialog(this,"警告",true);

Panel p1=new Panel();

p1.add(new Label("您无权进本系统!"));

d1.add("Center",p1);

Panel p2=new Panel();

p2.add(btn1);

d1.add("South",p2);

d1.setSize(200,100);

d1.show();

}

}

if(e.getSource()==btn1)

{

d1.dispose();

}

if(e.getSource()==pn9.pn4.btn3)

{

dispose();

System.exit(0);

}

if(e.getSource()==pn9.pn4.btn2)

{

pn9.pn6.ta.setText("");

ss.append(" 您的姓名是:"+pn9.pn2.t1.getText()+" "+"您的学号是:"+pn9.pn2.t2.getText()+" ");

ss.append("您的专业是:"+pn9.pn3.t1.getText()+" "+"您所在院(系)是:"+pn9.pn3.t2.getText()+" ");

ss.append("您的所有信息将被保存!");

pn9.pn6.ta.setText(ss.toString());

user s1=new user(pn9.pn2.t1.getText(),pn9.pn2.t2.getText(),pn9.pn3.t1.getText(),pn9.pn3.t2.getText(),ss.toString());

int i;

for(i=0;ixiang.size();i++)

{

user s=(user)xiang.elementAt(i);

if(s.sd.compareTo(s1.sd)==0)

{

s.username=s1.username;

s.sd=s1.sd;

s.major=s1.major;

s.institute=s1.institute;

s.course=s1.course;

xiang.setElementAt(new user(s.username,s.sd,s.major,s.institute,s.course),i);

break;

}

}

if(i==xiang.size())

xiang.addElement(new user(pn9.pn2.t1.getText(),pn9.pn2.t2.getText(),pn9.pn3.t1.getText(),pn9.pn3.t2.getText(),ss.toString()));

}

if(e.getSource()==pn9.pn4.btn1)

{

pn9.pn6.ta.setText("");

if(pn9.pn2.t2.getText()=="")

{

d1=new Dialog(this,"注意",true);

Panel p1=new Panel();

p1.add(new Label("按学号进行查询!请输入学号!再按此键!"));

d1.add("Center",p1);

Panel p2=new Panel();

p2.add(btn1);

d1.add("South",p2);

d1.setSize(250,100);

d1.show();

}

int i;

for(i=0;ixiang.size();i++)

{

user s=(user)xiang.elementAt(i);

if(s.sd.compareTo(pn9.pn2.t2.getText())==0)

{

pn9.pn2.t1.setText(""+s.username);

pn9.pn3.t1.setText(""+s.major);

pn9.pn3.t2.setText(""+s.institute);

pn9.pn6.ta.setText("您选修的课程有:"+s.course);

break;

}

}

if(i==xiang.size())

{

d1=new Dialog(this,"警告",true);

Panel p1=new Panel();

p1.add(new Label("用户不存在!请重新输入!"));

d1.add("Center",p1);

Panel p2=new Panel();

p2.add(btn1);

d1.add("South",p2);

d1.setSize(200,100);

d1.show();

}

}

}

public void itemStateChanged(ItemEvent e)

{

List temp;

String sList[];

String mgr=new String("");

if(e.getItemSelectable()instanceof List)

{

temp=(List)(e.getItemSelectable());

sList=temp.getSelectedItems();

for(int i=0;isList.length;i++)

mgr=mgr+sList[i]+" ";

ss.append(mgr);

}

}

}

本程序已经成功!!!望再验证!!!!

求用Java编写的学生成绩管理系统的完整代码

package jdbcproj;

import java.sql.*;

import java.awt.BorderLayout;

import java.awt.EventQueue;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

import javax.swing.JButton;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.awt.event.ActionEvent;

public class MainFrame extends JFrame {

private JPanel contentPane;

private JTextField txtname;

private JTextField txtpassword;

/**

 * Launch the application.

 */

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

MainFrame frame = new MainFrame();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

}

}

});

}

/**

 * Create the frame.

 */

public MainFrame() {

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(100, 100, 661, 399);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

JLabel lblNewLabel = new JLabel("\u7528\u6237\u540D");

lblNewLabel.setBounds(114, 51, 72, 18);

contentPane.add(lblNewLabel);

JLabel lblNewLabel_1 = new JLabel("\u5BC6\u7801");

lblNewLabel_1.setBounds(114, 106, 72, 18);

contentPane.add(lblNewLabel_1);

txtname = new JTextField();

txtname.setBounds(261, 48, 86, 24);

contentPane.add(txtname);

txtname.setColumns(10);

txtpassword = new JTextField();

txtpassword.setBounds(261, 103, 86, 24);

contentPane.add(txtpassword);

txtpassword.setColumns(10);

JButton btnadd = new JButton("\u589E\u52A0");

btnadd.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

if(txtname.getText().equals("")||txtpassword.getText().equals(""))

{

JOptionPane.showMessageDialog(getContentPane(), "用户名和密码不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);

}

else{

Users u=new Users();

u.setPwd(txtpassword.getText());

u.setUsername(txtname.getText());

UserDAO usdo=new UserDAO();

usdo.addUser(u);

}

}

});

btnadd.setBounds(45, 205, 113, 27);

contentPane.add(btnadd);

JButton btndelete = new JButton("\u5220\u9664");

btndelete.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

if(txtname.getText().equals(""))

{

JOptionPane.showMessageDialog(getContentPane(), "用户名不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);

}

else{

UserDAO usdo=new UserDAO();

usdo.delUser(txtname.getText());;

}

}

});

btndelete.setBounds(172, 205, 113, 27);

contentPane.add(btndelete);

JButton btnupdate = new JButton("\u4FEE\u6539");

btnupdate.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

if(txtname.getText().equals("")||txtpassword.getText().equals(""))

{

JOptionPane.showMessageDialog(getContentPane(), "用户名和密码不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);

}

else{

Users u=new Users();

u.setPwd(txtpassword.getText());

u.setUsername(txtname.getText());

UserDAO usdo=new UserDAO();

usdo.updateUser(u);;

}

}

});

btnupdate.setBounds(300, 205, 113, 27);

contentPane.add(btnupdate);

JButton btnfind = new JButton("\u67E5\u8BE2");

btnfind.addActionListener(new ActionListener() {

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学生管理系统代码···

lListStudent students = new ArrayListStudent();

BufferedReader br = new BufferedReader(new FileReader("D:\student.txt"));

String tmpStr = br.readLine();

while(tmpStr != null){

int firstIndex = tmpStr.indexOf(" ");

int secondIndex = tmpStr.indexOf(" ",firstIndex + 1);

int thirdIndex = tmpStr.indexOf(" ", secondIndex + 1);

int forthIndex = tmpStr.indexOf(" ", thirdIndex + 1);

Integer stuId = Integer.parseInt(tmpStr.substring(0,firstIndex));

String stuName = tmpStr.substring(firstIndex + 1,secondIndex);

Integer stuYW = Integer.parseInt(tmpStr.substring(secondIndex + 1,thirdIndex));

Integer stuSX = Integer.parseInt(tmpStr.substring(thirdIndex + 1,forthIndex));

Integer stuYY = Integer.parseInt(tmpStr.substring(forthIndex + 1));

Student student = new Student();

student.setStuId(stuId);

student.setStuName(stuName);

student.setStuYW(stuYW);

student.setStuSX(stuSX);

student.setStuYY(stuYY);

students.add(student);

tmpStr.readLine();

}

//创建一个学生实体类 封装stuId stuName stuYW stuSx stuYY 这5个属性。。。

//已经帮你把数据拆分出来 并以Student 对象的形式放入集合中了 接下来 给分吧 哇咔咔


分享文章:教务系统的java代码,教务系统编程
文章链接:http://jkwzsj.com/article/heeipp.html

其他资讯