1. 程式人生 > >兩隻小熊隊高階軟體工程第七次作業敏捷衝刺3

兩隻小熊隊高階軟體工程第七次作業敏捷衝刺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);
	}

}