「java教务系统登录界面」java教务系统登录界面打不开

博主:adminadmin 2023-01-27 12:30:10 374

本篇文章给大家谈谈java教务系统登录界面,以及java教务系统登录界面打不开对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

登录界面的java代码,分别有教师登录,管理员登录,学生登录,右边是用户名和密码,见图。

分三个包,自己建个包,导进去就ok了,数据库是access的。

package 登录;

import java.awt.EventQueue;

public class Cilent {

private JFrame frame;

private JTextField textField;

private JPasswordField passwordField;

/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

Cilent window = new Cilent();

window.frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

}

}

});

}

/**

* Create the application.

*/

public Cilent() {

initialize();

}

/**

* Initialize the contents of the frame.

*/

private void initialize() {

frame = new JFrame();

frame.setTitle("登陆界面");

frame.setBounds(100, 100, 450, 300);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().setLayout(null);

frame.setResizable(false);

JLabel lblNewLabel = new JLabel("用户名");

lblNewLabel.setBounds(38, 43, 80, 34);

frame.getContentPane().add(lblNewLabel);

textField = new JTextField();

textField.setBounds(155, 42, 227, 37);

frame.getContentPane().add(textField);

textField.setColumns(10);

JLabel label = new JLabel("密 码");

label.setBounds(38, 115, 80, 34);

frame.getContentPane().add(label);

passwordField = new JPasswordField();

passwordField.setBounds(155, 115, 227, 37);

frame.getContentPane().add(passwordField);

JButton btnNewButton = new JButton("登 录");

btnNewButton.setBounds(60, 187, 115, 34);

frame.getContentPane().add(btnNewButton);

btnNewButton.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent arg0) {

// TODO Auto-generated method stub

UserCheck UC=new UserCheck(textField.getText(),String.valueOf(passwordField.getPassword()));

if(UC.getI()!=0) //有此用户

{

frame.setVisible(false);

}

else

{

textField.setText("");

passwordField.setText("");

}

}

});

JButton button = new JButton("取 消");

button.setBounds(242, 187, 115, 34);

frame.getContentPane().add(button);

button.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent arg0) {

// TODO Auto-generated method stub

textField.setText("");

passwordField.setText("");

}

});

}

}

/*****************************************************************/

package 登录;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import 操作处理.UsersCL;

/**@author 20111024

* 检测登录的用户在数据库中有无,若没有,则提示没有此用户,

* 若有,则判断级别:普通用户还是管理员。

*/

public class UserCheck {

private int i=0; //用户级别:0不是用户、1是管理员、2是普通用户

UserCheck(String name ,String password)

{

String jdriver="sun.jdbc.odbc.JdbcOdbcDriver";

String connectDB="jdbc:odbc:Students";

Statement stmt=null;

ResultSet rs=null;

Connection con=null;

try {

Class.forName(jdriver);

con=DriverManager.getConnection(connectDB);

stmt=con.createStatement();

String query="select * from users where name='"+name+"' and passwd='"+password+"'";

rs=stmt.executeQuery(query);

if(rs.next())

{

//数据库中有此用户,访问成功

i=Integer.parseInt(rs.getString(3));

UsersCL UL=new UsersCL(i);

}

else

{

i=0; //没有用户是默认是0级

}

} catch (ClassNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public int getI() {

return i;

}

}

/********************************************************************************************/

package 操作处理;

import java.awt.EventQueue;

public class UsersCL implements ActionListener{

private JFrame frame;

private JTextField textField;

private JTextField textField_1;

private JTextField textField_2;

private JTextField textField_3;

private int i=0;

private JLabel label_3;

private JTextField textField_4;

public UsersCL(int i) {

this.i=i;

frame = new JFrame();

frame.setTitle("用户处理界面");

frame.setBounds(100, 100, 450, 300);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().setLayout(null);

frame.setResizable(false);

frame.setVisible(true);

JLabel lblNewLabel = new JLabel("学 号");

lblNewLabel.setBounds(24, 32, 74, 29);

frame.getContentPane().add(lblNewLabel);

JLabel label = new JLabel("姓 名");

label.setBounds(24, 71, 74, 29);

frame.getContentPane().add(label);

JLabel label_1 = new JLabel("年 龄");

label_1.setBounds(24, 110, 74, 29);

frame.getContentPane().add(label_1);

label_3 = new JLabel("性 别");

label_3.setBounds(24, 149, 74, 29);

frame.getContentPane().add(label_3);

JLabel label_2 = new JLabel("状 态");

label_2.setBounds(24, 195, 74, 29);

frame.getContentPane().add(label_2);

textField = new JTextField();

textField.setBounds(101, 34, 113, 25);

frame.getContentPane().add(textField);

textField.setColumns(10);

textField_1 = new JTextField();

textField_1.setColumns(10);

textField_1.setBounds(101, 73, 113, 25);

frame.getContentPane().add(textField_1);

textField_2 = new JTextField();

textField_2.setColumns(10);

textField_2.setBounds(101, 112, 113, 25);

frame.getContentPane().add(textField_2);

textField_3 = new JTextField();

textField_3.setEditable(false);

textField_3.setColumns(10);

textField_3.setBounds(101, 199, 288, 25);

frame.getContentPane().add(textField_3);

textField_4 = new JTextField();

textField_4.setColumns(10);

textField_4.setBounds(101, 149, 113, 25);

frame.getContentPane().add(textField_4);

if(1==i)

{

JButton btnNewButton = new JButton("追 加");

btnNewButton.setBounds(276, 41, 113, 29);

frame.getContentPane().add(btnNewButton);

btnNewButton.addActionListener(this);

btnNewButton.setActionCommand("追加");

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

button_1.setBounds(276, 145, 113, 29);

frame.getContentPane().add(button_1);

button_1.addActionListener(this);

button_1.setActionCommand("删除");

}

JButton button = new JButton("查 询");

button.setBounds(276, 91, 113, 29);

frame.getContentPane().add(button);

button.addActionListener(this);

button.setActionCommand("查询");

}

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

String name,age,sex,query=null;

int num,age1,count=0;

num=Integer.parseInt(textField.getText());

name=textField_1.getText();

age1=Integer.parseInt(textField_2.getText());

sex=textField_4.getText();

if(e.getActionCommand().equals("追加"))

{

query="insert into students values("+num+","+"'"+name+"',"+age1+",'"+sex+"');";

count=1;

}

else if(e.getActionCommand().equals("查询"))

{

query="select * from students where XSB="+num+";";

count=2;

}

else if(e.getActionCommand().equals("删除"))

{

query="delete from students where XSB="+num+" and name="+"'"+name+"'";

count=3;

}

Statement stmt=null;

ResultSet rs=null;

Connection con=null;

String jdriver="sun.jdbc.odbc.JdbcOdbcDriver";

String connectDB="jdbc:odbc:Students";

String query1=null;

try {

Class.forName(jdriver);

con=DriverManager.getConnection(connectDB);

stmt=con.createStatement();

if(count==1)

{

query1="select * from students where XSB="+num+";";

rs=stmt.executeQuery(query1);

if(rs.next())

textField_3.setText("已经由此记录,不能追加!");

else

{

stmt.executeUpdate(query);

textField_3.setText("已经追加完成!");

}

}

else if(2==count)

{

stmt.executeQuery(query);

rs=stmt.executeQuery(query);

if(rs.next())

{

textField_3.setText("已查找到此记录!");

}

else

{

textField_3.setText("没有此记录,可以追加!");

}

}

else if(3==count)

{

query1="select * from students where XSB="+num+" and name="+"'"+name+"'";

rs=stmt.executeQuery(query1);

if(rs.next())

{

stmt.executeUpdate(query);

textField_3.setText("已删除此记录!");

}

else

textField_3.setText("无此记录!");

}

} catch (ClassNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

finally{

//关闭资源

if(stmt!=null){

try {

stmt.close();

} catch (Exception e2) {

// TODO: handle exception

}

stmt=null;

}

if(con!=null){

try {

con.close();

} catch (Exception e2) {

// TODO: handle exception

}

con=null;

}

}

}

}

班务管理系统java登录界面分为用户登录和管理员登录

不对。

班务管理系统java登录界面分为用户登录和管理员登录,还有一个是学生登录,所以班务管理系统java登录界面分为用户登录和管理员登录是不对的。

班务管理系统java包括用户登录模块、班级管理模块、成绩管理模块、教师管理模块、学生管理模块等,主要实现了对学生的个人基本信息和学生成绩的管理。

JAVA编程如何实现一个学生信息管理系统登录界面?

importjava.awt.*;\x0d\x0aimportjava.awt.event.*;\x0d\x0aimportjava.applet.*;\x0d\x0aimportjava.applet.Applet;\x0d\x0aimportjava.io.*;\x0d\x0aimportjavax.xml.parsers.DoumentBuilderFactory;\x0d\x0a\x0d\x0apublicclassUserPanelextendsAppletimplentsActionListener\x0d\x0a{\x0d\x0aLabellblName,lblNumber,lblSex,lblJob,lblText;\x0d\x0aTextFieletfName.tfNumber;\x0d\x0acheckboxchMale,chFemale;\x0d\x0aTextAreataText;\x0d\x0achoicechJob;\x0d\x0aButtonbtnOk,btnDisply;\x0d\x0aPanelp1,p2,p3,p4,p5,p6,p7,p8,p9;\x0d\x0aStringstrName,strNumber,strSex,strJob,strText;\x0d\x0a\x0d\x0apublicvoidinit()\x0d\x0a{\x0d\x0alblName=newLabel("姓名");\x0d\x0alblNumber=newLabel("身份证号");\x0d\x0alblSex=newLabel("性别");\x0d\x0alblJob=newLabel("职业");\x0d\x0alblText=newLabel("个性化宣言");\x0d\x0atfName=newTextField(23);\x0d\x0atfNumber=newTextFidle(20);\x0d\x0ataText=newTextArea(10,20);\x0d\x0ac=newcheckboxGroup();\x0d\x0achMale=newcheckbox("男",c,true);\x0d\x0achFemale=newcheckbox("女",c,false);\x0d\x0achJob=newchoice();\x0d\x0achJob.add("学生");\x0d\x0abtnOk=newButton("确定");\x0d\x0abtnDisplay=newButton("显示");\x0d\x0ap1=newpanel();\x0d\x0ap2=newpanel();\x0d\x0ap3=newpanel();\x0d\x0ap4=newpanel();\x0d\x0ap5=newpanel();\x0d\x0ap6=newpanel();\x0d\x0ap7=newpanel(newBorderLayout());\x0d\x0ap8=newpanel();\x0d\x0ap9=newpanel(newBorderLayout());\x0d\x0a//\x0d\x0ap1.add(lblName);\x0d\x0ap1.add(tfName);\x0d\x0ap2.add(lblNumber);\x0d\x0ap2.add(lblNumber);\x0d\x0ap3.add(lblSex);\x0d\x0ap3.add(chMale);\x0d\x0ap3.add(chFemale);\x0d\x0ap4.add(lblJob);\x0d\x0ap4.add(chJob);\x0d\x0ap5.add(p3);\x0d\x0ap5.add(p4);\x0d\x0ap6.setLayout(newBorderLayout());\x0d\x0ap6.add(p1,BorderLayout.NORTH);\x0d\x0ap6.add(p2,BorderLayout.CENTER);\x0d\x0ap6.add(p5,BorderLayout.SOUTH);\x0d\x0ap7.add(lblText,BorderLayout.NORTH);\x0d\x0ap7.add(lblText,BorderLayout.CENTER);\x0d\x0ap8.setLayout(newFlowLayout(FlowLayout.CENTER,30,10));\x0d\x0ap8.add(btnOK);\x0d\x0ap8.add(btnDisplay);\x0d\x0ap9.add(p6,BorderLayout.NORTH);\x0d\x0ap9.add(p7,BorderLayout.CENTER);\x0d\x0ap9.add(p8,BorderLayout.SOUTH);\x0d\x0aadd(p9);\x0d\x0a//\x0d\x0abtnOK.addActionListener(this);\x0d\x0abtnDisplay.addActionListener(this);\x0d\x0abtnDisplay.setEnabled(false);\x0d\x0astrName=newString();\x0d\x0astrNumber=newString();\x0d\x0astrSex=newString();\x0d\x0astrJob=newString();\x0d\x0astrText=newString();\x0d\x0a}\x0d\x0a\x0d\x0apublicvoidactionPerformed(ActionEventevt)\x0d\x0a{\x0d\x0astringarg=evt.getActionCommand();\x0d\x0a//\x0d\x0aif(arg.equals("确定"))\x0d\x0a{\x0d\x0astrName=tfName.getText().trim();\x0d\x0astrNumber=tfNumber.getText().trim();\x0d\x0aif(chMale.getState())\x0d\x0astrSex="男";\x0d\x0aelse\x0d\x0astrSex="女";\x0d\x0astrJob=chJob.getselectedItem();\x0d\x0astrText=taText.getText().trim();\x0d\x0atry\x0d\x0a{\x0d\x0a//\x0d\x0aDoumentBuildFactorydbf=DocumentBuilderFactory.newInstance();\x0d\x0adb=dbf.newDocumentBuilder();\x0d\x0aDoumentdoc=db.newDoument();\x0d\x0a//\x0d\x0aElementroot=doc.CreateElement("UserDAta");\x0d\x0aElementeName=doc.createElement("Name");\x0d\x0aElementeNumber=doc.createElement("Number");\x0d\x0aElementeJob=doc.createElement("Job");\x0d\x0aElementeText=doc.createElement("Text");\x0d\x0a//\x0d\x0aroot.appendChild(eName);\x0d\x0aroot.appendChild(eNumber);\x0d\x0aroot.appendChild(eSex);\x0d\x0aroot.appendChild(eJob);\x0d\x0aroot.appendChild(eText);\x0d\x0a//\x0d\x0aeName.appendChild(doc.creatTextNode("\n"strName"\n"));\x0d\x0aeNumber.appendChild(doc.creatTextNode("\n"strNumber"\n"));\x0d\x0aeSex.appendChild(doc.creatTextNode("\n"strSex"\n"));\x0d\x0aeJob.appendChild(doc.creatTextNode("\n"strJob"\n"));\x0d\x0aeText.appendChild(doc.creatTextNode("\n"strText"\n"));\x0d\x0a//\x0d\x0aFilef=newFile("user.xml");\x0d\x0aFileOutputStreamfOut=newFileOutStream(f);\x0d\x0a//\x0d\x0afOut.write("

java怎么通过代码登入教务系统

我使用几系统都B/S结构每登录都需要输入用户名密码觉非麻烦考虑其同事需求妨写自登录程序吧前考虑使用单点登录几经尝试放弃

我习惯使用Java本能始寻找Java解决Google输入Java自登录、Java网页模拟登录、Java Post 登录结倒少内容差我尝试终究没达我预期目标我都知道些代码应该jsp页面执行c/s结构程序执行些代码确实管用

我先析代码

String surl = "";

URL url = new URL(surl);

URLConnection conn = url.openConnection();

conn.setDoOutput(true);

OutputStreamWriter out=new OutputStreamWriter(conn.getOutputStream());

String str = "username=yournamepassword=123456";

out.write(str);

out.flush();

out.close();

C/S结构且参数确程序能够功登录oa系统要看结通面代码系统服务器返结System.out.println()

String sling = "";

String scontent = "";

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));

while ((sling = in.readLine()) != null)

scontent += in + "\r\n";

System.out.println(scontent);

C/S结构控制台输返值返内容看程序已经功登录要网址浏览器打重新登录问题没根本解决恶意注册应该达目

看C/S结构容易实现网页程序自登录除非C/S程序内嵌浏览器直接浏览器自访问系统应该没别主要问题于我没办共享Session

便于共享Session我能浏览器实现网页自登录通面代码jsp页面测试达预期目标

网页自登录希望程序自填充用户名密码Post式提交给登录页面Form所指向action页面或我系统登录页面源代码保存网页usernamepassword文本框设置默认值通网页登录系统测试发现行接能已经想解决

我通url.openConnection()建立连接返scontent打印接着打印代码:

out.println("\r\n");

原理简单通login.jsp登录页面全部源代码写前页面使用javascript脚本用户名密码值填充提交表单终于实现自登录目标现我通特殊网址例自访问oa

能注意参数url值经加密内容用户名密码加效期即效期内链接才效才实现自登录

用java模拟登陆学校教务处,重定向问题

你首先去登录一下这个页面,使用开发调试工具,例如firebug去看一下你点击登录的时候,发送的什么请求,你就可以发送请求到这个请求地址。

java 用 eclips怎样创建 学生信息管理系统登录界面

创建GUI?

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import javax.swing.DropMode;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

import javax.swing.border.EmptyBorder;

import com.dao.UserDao;

import com.entity.User;

import com.util.DBUtil;

public class LogFrm extends JFrame{

private JPanel contentPane;

private JTextField textField;

private JPasswordField passwordField;

DBUtil dbUtil =new DBUtil();

UserDao userDao= new UserDao();

public LogFrm(){

setLocation(100, 300);

setTitle("商品信息管理系统管理员登录界面");

setVisible(true);

setSize(400, 300);

setResizable(false);

show();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(100, 100, 450, 300);

contentPane = new JPanel();

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

contentPane.setLayout(null);

setContentPane(contentPane);

JLabel lblNewLabel = new JLabel("商品信息管理系统");

lblNewLabel.setBounds(160, 30, 119, 18);

contentPane.add(lblNewLabel);

JLabel lblNewLabel_1 = new JLabel("账号:");

lblNewLabel_1.setBounds(92, 90, 100, 18);

contentPane.add(lblNewLabel_1);

JLabel lblNewLabel_2 = new JLabel("密码:");

lblNewLabel_2.setBounds(92, 130, 100, 18);

contentPane.add(lblNewLabel_2);

textField = new JTextField();

textField.setDropMode(DropMode.INSERT);

textField.setBounds(150, 90, 148, 24);

contentPane.add(textField);

textField.setColumns(10);

passwordField = new JPasswordField();

passwordField.setDropMode(DropMode.INSERT);

passwordField.setBounds(150, 130, 148, 24);

contentPane.add(passwordField);

JButton login = new JButton("登录");

login.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String username = textField.getText();

String password = passwordField.getText();

if("".equals(username)||username.trim()==null)

{

JOptionPane.showMessageDialog(null,"用户名不能为空!");

return;

}

if("".equals(password)||password.trim()==null)

{

JOptionPane.showMessageDialog(null,"密码不能为空!");

return;

}

Connection con= null;

User user = new User(username,password);

try {

con=dbUtil.getConnection();

User currentUser = userDao.login(user);

if(currentUser!=null)

{

dispose();

new MainFrame().setVisible(true);

}

else

{

JOptionPane.showMessageDialog(null,"用户名或密码错误!");

}

} catch (Exception e1) {

e1.printStackTrace();

JOptionPane.showMessageDialog(null,"登陆失败!");

}finally{

try {

dbUtil.close(con);

} catch (Exception e1) {

e1.printStackTrace();

}

}

}

});

login.setBounds(82, 195, 113, 27);

contentPane.add(login);

JButton reset = new JButton("重置");

reset.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

textField.setText("");

passwordField.setText("");

}

});

reset.setBounds(225, 195, 113, 27);

contentPane.add(reset);

}

public static void main(String[] args){

LogFrm frm = new LogFrm();

}

}

java教务系统登录界面的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java教务系统登录界面打不开、java教务系统登录界面的信息别忘了在本站进行查找喔。