两只小熊队高级软件工程第七次作业敏捷冲刺3

团队的作业:学生信息管理系统

  • 队员学号:

    周菲(队长) 201810812007

    孔繁燕    201810812001

Alpha敏捷冲刺:

1、 站立式会议照片:

2、每个人的工作:

周菲:

今天已完成:1、完成登陆界面响应窗体,登陆成功即出现主窗体,登陆失败消息窗体提示;2、完成主界面的设计;

遇到的问题:窗体点击响应失败;

明天计划完成:学生信息管理窗体实现添加学生信息功能;

孔繁燕:

今天已完成:完成主界面的设计。

遇到的问题;窗体点击响应失败;

明天计划完成:学生信息管理窗体实现添加学生信息功能测试;

3、项目燃尽图

4、功能截图及代码:

登陆系统失败消息提示:

登陆系统成功则显示主窗体:

部分代码如下:

package ui;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import model.LoginMessage;
import service.UserService;

import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Font;
import java.awt.Color;
import java.awt.SystemColor;
import java.awt.Window.Type;
import java.awt.Toolkit;

public class LoginFrame extends JFrame
{

	private JPanel contentPane;
	private JTextField txtUsername;
	private JTextField txtPassword;

	public LoginFrame()
	{
		setIconImage(Toolkit.getDefaultToolkit().getImage(LoginFrame.class.getResource("/com/sun/java/swing/plaf/windows/icons/Computer.gif")));
		setForeground(new Color(70, 130, 180));
		setBackground(new Color(70, 130, 180));
		setTitle("教务登陆系统v2.0");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(173, 216, 230));
		contentPane.setBorder(new EmptyBorder(0, 0, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblUsername = new JLabel("用户名:");
		lblUsername.setForeground(new Color(25, 25, 112));
		lblUsername.setFont(new Font("微软雅黑", Font.ITALIC, 16));
		lblUsername.setBounds(10, 54, 93, 30);
		contentPane.add(lblUsername);
		
		JLabel lblPassword = new JLabel("密码:");
		lblPassword.setForeground(new Color(25, 25, 112));
		lblPassword.setFont(new Font("微软雅黑", Font.ITALIC, 16));
		lblPassword.setBounds(10, 109, 93, 30);
		contentPane.add(lblPassword);
		
		txtUsername = new JTextField();
		txtUsername.setBounds(102, 60, 246, 21);
		contentPane.add(txtUsername);
		txtUsername.setColumns(10);
		
		txtPassword = new JTextField();
		txtPassword.setColumns(10);
		txtPassword.setBounds(102, 115, 246, 21);
		contentPane.add(txtPassword);
		
		JButton btnLogin = new JButton("登陆");
		btnLogin.setFont(new Font("微软雅黑", Font.PLAIN, 12));
		btnLogin.setForeground(new Color(25, 25, 112));
		btnLogin.setBackground(new Color(25, 25, 112));
		btnLogin.addActionListener(new ActionListener()
		{
			
			@Override
			public void actionPerformed(ActionEvent e)
			{
				
				//获得用户名
				String username=txtUsername.getText();
				String password=txtPassword.getText();

					UserService userService=new UserService();
					LoginMessage loginMessage=userService.login(username, password);
						//显示登陆信息

						if(loginMessage.isLogin())//登陆成功则显示主窗体
						{
							//主窗体设计
							MainFrame mainFrame=new MainFrame();
							mainFrame.setVisible(true);
							LoginFrame.this.setVisible(false);
						}
						else//未登陆成功弹窗显示
						{
							LoginMessageDialog loginDialog=new LoginMessageDialog(loginMessage.getMessage());
							loginDialog.setVisible(true);
						}
			
			}
		});
		btnLogin.setBounds(102, 203, 93, 23);
		contentPane.add(btnLogin);
		
		JButton btnCancel = new JButton("退出");
		btnCancel.setFont(new Font("微软雅黑", Font.PLAIN, 12));
		btnCancel.setForeground(new Color(25, 25, 112));
		btnCancel.setBackground(new Color(25, 25, 112));
		btnCancel.addActionListener(new ActionListener()
		{
			
			@Override
			public void actionPerformed(ActionEvent e)
			{
				//取消登陆
				System.exit(0);
				
			}
		});
		btnCancel.setBounds(255, 203, 93, 23);
		contentPane.add(btnCancel);
	}

}

 

 

 

posted on 2018-11-26 20:37  小雪zzz  阅读(135)  评论(0编辑  收藏  举报