如何用ja做一个学生管理系统平台的登录界面模块和添加模块?


如何用ja做一个学生管理系统平台的登录界面模块和添加界面模块!

下面是一个使用 Ja 编写的学生管理系统的登录界面模块和添加界面模块的示例代码:

如何用ja做一个学生管理系统平台的登录界面模块和添加模块?如何用ja做一个学生管理系统平台的登录界面模块和添加模块?


如何用ja做一个学生管理系统平台的登录界面模块和添加模块?


如何用ja做一个学生管理系统平台的登录界面模块和添加模块?


登录界面模块:

import jax.swing.;

import ja.awt.;

import ja.awt.nt.ActionEvent;

import ja.awt.nt.ActionListener;

public class Login extends JFrame implements ActionListener {

JLabel lb1, lb2;

JTextField tf1;

JPasswordField pf1;

JButton btn1, btn2;

public Login() {

setTitle("学生管理系统-登录");

setSize(300, 200);

setLocationRelativeTo(null);

lb1 = new JLabel("用户名:");

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

tf1 = new JTextField();

pf1 = new JPasswordField();

btn1 = new JButton("登录");

btn2 = new JButton("取消");

JPanel p1 = new JPanel();

p1.setLayout(new GridLayout(2, 2));

p1.add(lb1);

p1.add(tf1);

p1.add(lb2);

p1.add(pf1);

JPanel p2 = new JPanel();

p2.setLayout(new FlowLayout());

p2.add(btn1);

p2.add(btn2);

setLayout(new BorderLayout());

add(p1, BorderLayout.CENTER);

add(p2, BorderLayout.SOUTH);

btn1.addActionListener(this);

btn2.addActionListener(this);

}@Override

public void actionPerformed(ActionEvent e) {

if (e.getSource() == btn1) {

// 登录按钮被点击

String username = tf1.getText();

String password = new String(pf1.getPassword());

if (username.equals("admin") && password.equals("123456")) {

// 登录成功,打开主界面

MainFrame frame = new MainFrame();

frame.setVisible(true);

dise();

} else {

// 登录失败,弹出提示框

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

}} else if (e.getSource() == btn2) {

// 取消按钮被点击,关闭窗口

dise();

}}

public static void main(String[] args) {

Login frame = new Login();

frame.setVisible(true);

}}

在这个程序中,我们定义了一个 Login 类,继承了 JFrame 类,实现了登录界面的布局和逻辑。在登录界面中,我们使用了 JLabel、JTextField、JPasswordField、JButton 等控件来实现用户名和密码的输入和登录作。当用户点击登录按钮时,我们将输入的用户名和密码与预设的账号和密码进行比较,如果匹配成功,则打开主界面;否则,弹出提示框告知用户登录失败。添加界面模块:

import jax.swing.;

import ja.awt.;

import ja.awt.nt.ActionEvent;

import ja.awt.nt.ActionListener;

public class AddFrame extends JFrame implements ActionListener {

JLabel lb1, lb2, lb3, lb4, lb5, lb6;

JTextField tf1, tf2, tf3, tf4, tf5;

JButton btn1, btn2;

public AddFrame() {

setTitle("学生管理系统-添加");

setSize(400, 300);

setLocationRelativeTo(null);

lb1 = new JLabel("学号:");

lb2 = new JLabel("姓名:");

lb3 = new JLabel("性别:");

lb4 =new JLabel("出生日期:");

lb5 = new JLabel("籍贯:");

lb6 = new JLabel("所在院系:");

tf1 = new JTextField();

tf2 = new JTextField();

tf3 = new JTextField();

tf4 = new JTextField();

tf5 = new JTextField();

btn1 = new JButton("添加");

btn2 = new JButton("取消");

JPanel p1 = new JPanel();

p1.setLayout(new GridLayout(6, 2));

p1.add(lb1);

p1.add(tf1);

p1.add(lb2);

p1.add(tf2);

p1.add(lb3);

p1.add(tf3);

p1.add(lb4);

p1.add(tf4);

p1.add(lb5);

p1.add(tf5);

p1.add(lb6);

String[] deptList = {"计算机科学与技术", "信息工程", "物联网工程"};

JComboBox comboBox = new JComboBox<>(deptList);

p1.add(comboBox);

JPanel p2 = new JPanel();

p2.setLayout(new FlowLayout());

p2.add(btn1);

p2.add(btn2);

setLayout(new BorderLayout());

add(p1, BorderLayout.CENTER);

add(p2, BorderLayout.SOUTH);

btn1.addActionListener(this);

btn2.addActionListener(this);

}@Override

public void actionPerformed(ActionEvent e) {

if (e.getSource() == btn1) {

// 添加按钮被点击

String id = tf1.getText();

String name = tf2.getText();

String = tf3.getText();

String birth = tf4.getText();

String hometown = tf5.getText();

String dept = comboBox.getSelectedItem().toString();

// TODO: 将学生信息添加到数据库中

JOptionPane.showMessageDialog(this, "添加成功!");

} else if (e.getSource() == btn2) {

// 取消按钮被点击,关闭窗口

dise();

}}

public static void main(String[] args) {

AddFrame frame = new AddFrame();

frame.setVisible(true);

}在这个程序中,我们定义了一个 `AddFrame` 类,继承了 `JFrame` 类,实现了添加界面的布局和逻辑。在添加界面中,我们使用了 `JLabel`、`JTextField`、`JComboBox`、`JButton` 等控件来实现学生信息的输入和添加作。当用户点击添加按钮时,我们将输入的学生信息添加到数据库中,并弹出提示框告知用户添加成功;否则,直接关闭窗口。需要注意的是,在实际的开发中,我们需要将学生信息添加到数据库中,这里只是简单地用一个 TODO 注释标记了这个作。

谁能帮我用C#写个简单的登录系统?

using System;

using System.Data;

using System.Data.OleDb;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Windows.Forms;

using System.Data.Sql;

using System.Data.OleDb;

namespace connectaccess

{public partial class Form1 : Form

{public Form1()

{InitializeComponent();

}private void button1_Click(object sender, EventArgs e)

{string mdbPath;

mdbPath = Application.StartupPath;

mdbPath += "connect.mdb"; //我的mdb文件名

OleDbConnection mdbConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data source="+mdbPath);

mdbConn.Open();

OleDbCommand mdbCmd = mdbConn.CreateCommand();

mdbCmd.CommandText = "select from test where name="" + textBox2.Text + "" and password=""+textBox1.Text+""" ;

//MessageBox.Show(mdbCmd.CommandText);

mdbCmd.CommandType = CommandType.Text;

OleDbDataReader mdbReader = mdbCmd.ExecuteReader();

//MessageBox.Show("1111111");

if (mdbReader.HasRows)

{Form a = new Form2();

a.Show();

}else

{MessageBox.Show("登录失败!");

}}

}}

怎样用VB编写一个登陆系统,可以注册账号的那种

1、打开“Microsoft Visual Basic 6.0 中文版”,选择“标准 EXE”,并单击“打开”按钮,进入软件界面。

2、建立如图所示窗体。

3、双击窗体,定义如下全局变量。

4、双击“开始”按钮。

5、输入如下代码。

6、双击“停止”按钮。

7、双击Timer控件,输入如下代码。

8、运行程序,单击“开始”按钮,计时器开始计时。

可以按照程序的大小选择存储方式。小程序保存在文本文件里就可以了,大程序就写数据库。如果觉得文本文件不安全再加个ASC加密。

配个数据库,读的时候去数据库读,注册的时候写入数据库

怎样用VB编写一个登陆系统,可以注册账号的那种

1、打开“Microsoft Visual Basic 6.0 中文版”,选择“标准 EXE”,并单击“打开”按钮,进入软件界面。

2、建立如图所示窗体。

3、双击窗体,定义如下全局变量。

4、双击“开始”按钮。

5、输入如下代码。

6、双击“停止”按钮。

7、双击Timer控件,输入如下代码。

8、运行程序,单击“开始”按钮,计时器开始计时。

用vb编一个简单的登录系统

这是一个例子。Access 中有一个表,“学生表”,表中有“姓名”,"学号"字段。

VB窗体有两个,一个名为“Form1", 另一个名为"Form2"

Form1是登录窗体,该窗体上有Text1, Text2 和Command1控件。 在Form1窗体中加入下面代码:

Public cnn As New ADODB.Connection

Public rs As New ADODB.Recordset

Private Sub Form_Load()

cnn.Open "Driver=Microsoft Access Driver (.mdb);DBQ=" & App.Path & "学生表.mdb;"

End Sub

Private Sub Command1_Click()

If (Text1.Text = "") Or (Text2.Text = "") Then

MsgBox "用户名和密码不能为空!", vbOKOnly, "提示:"

End If

rs.Open "SELECT FROM 学生表 where 姓名='" & Text1 & "' and 学号='" & Text2 & "'", cnn, adOpenKeyset, adLockOptimistic

If rs.RecordCount > 0 Then

If rs.Fields("学号") = Text2.Text Then

MsgBox "登录成功!"

Unload Me

Form2.Show

Else

Unload Me

End If

End If

rs.Close

End Sub

用JAVA编写一个登陆系统。

就写内容:

主方法:

Scanner scan = new Scanner(System.in);

String userName = scan.next();

String password = scan.next();

login(userName ,password );

(login是另一个静态方法方法内容是:)

if(userName .equals(正确的用户名) &&password .equals(正确的密码)){

//里面写处理信息.

}

现在40岁了学什么技术好_40岁学啥技术好挣钱
上一篇
白城电视台直播赚钱文案 电视台挣钱模式
下一篇
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 836084111@qq.com ,一经查实,本站将立刻删除。

相关推荐