亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testgui.java

?? 在線考試系統設計
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
	private void operationBoxSetting() {

		operationBox = Box.createHorizontalBox();
		operationBox.add(new JLabel("操作"));
		operationBox.add(Box.createHorizontalStrut(5));

		operationBox.add(Box.createHorizontalStrut(5));

		// 查看分數
		lookScore = new JButton("查看分數");

		lookScore.setEnabled(false);
		lookScore.addActionListener(this);
		operationBox.add(lookScore);
		// 讀上一題
		previous = new JButton("上一題");
		previous.addActionListener(this);
		previous.setEnabled(false);
		operationBox.add(previous);
		
		operationBox.add(Box.createHorizontalStrut(5));
		// 讀下一題
		next = new JButton("下一題");
		next.addActionListener(this);
		next.setEnabled(false);
		operationBox.add(next);
		operationBox.add(Box.createHorizontalStrut(5));

		// 查看所作題目
		preview = new JButton("預覽");
		operationBox.add(preview);
		preview.addActionListener(this);
		operationBox.add(Box.createHorizontalStrut(5));

		// 查找所做完的題目答案
		search = new JButton("查找");
		search.addActionListener(this);
		search.setEnabled(false);
		operationBox.add(search);
		operationBox.add(Box.createHorizontalStrut(5));

		// 將答案提交到服務器
		submit = new JButton("提交");
		submit.addActionListener(this);
		operationBox.add(submit);

		operationBox.add(Box.createHorizontalStrut(5));
		operationBox.add(Box.createHorizontalGlue());
		operationBox.add(answerBox);
		operationBox.add(Box.createHorizontalGlue());
		Border caozuoborder = BorderFactory.createTitledBorder(BorderFactory
				.createLineBorder(Color.black, 1), "", TitledBorder.CENTER,
				TitledBorder.ABOVE_TOP, new Font("GB_2312", Font.BOLD, 16),
				Color.BLACK);
		operationBox.setBorder(caozuoborder);
	}

	private void testBoxSetting() {
		lastTimeL = new JLabel("離考試結束時間還有:");

		lastTimeF = new JTextField(10);
		lastTimeP = new JPanel();
		lastTimeL.setForeground(Color.RED);
		lastTimeF.setForeground(Color.RED);
		lastTimeF.setEditable(false);
		lastTimeP.add(lastTimeL);
		lastTimeP.add(lastTimeF);

		testBox = Box.createVerticalBox();
		String a = new String();

		testArea = new JTextArea(20, 10);
		testArea.setEditable(false);

		a = "天是透明的 因為雪慢慢的停了\n心是透明的 因為我不想隱藏了 \n天是透明的 因為黑夜已過去了 \n因為你對我笑了 所以想念很快樂 \n心是透明的 因為有你永遠陪著 \n因為你決定愛了 所以等待也是值得\n你看不到我的蒼涼,我依然帶你去飛翔;\n你看不到我的迷惘,我依然帶你去流浪; \n你找不到的地方,我和你一起跳舞、歌唱; \n你找不到的天堂,我把它拿來放在你手上。 \n";
		// a="十里平湖霜滿天\n寸寸青絲愁華年\n對月形單望相顧\n只羨鴛鴦不羨仙";
              testArea.setText(a);
		testArea.setForeground(Color.RED);
		testArea.setFont(new Font("楷體_GB2312", Font.PLAIN, 24));

		answerAndWorkBox = Box.createVerticalBox();
		answerAndWorkBox.setSize(60, 30);
		answerAndWorkBox.add(workBox, BorderLayout.NORTH);
		answerAndWorkBox.add(new JScrollPane(testArea), BorderLayout.CENTER);
		answerAndWorkBox.add(operationBox, BorderLayout.SOUTH);

		testLabel = new JLabel("試  題");
		testLabel.setFont(new Font("新宋", Font.PLAIN, 24));

		testBox.setForeground(Color.BLUE);
		testBox.add(Box.createVerticalStrut(10));
		testBox.add(testLabel);
		testBox.add(lastTimeP);
		// testBox.add()
		testBox.add(answerAndWorkBox);

	}

	private void inputBoxSetting() {

		inputBox = Box.createHorizontalBox();
		inputBox.setVisible(false);
		inputBox.add(split_one, BorderLayout.CENTER);

		Border border = BorderFactory.createTitledBorder(BorderFactory
				.createLineBorder(Color.BLACK, 1), "學生考試系統",
				TitledBorder.CENTER, TitledBorder.ABOVE_TOP, new Font(
						"楷體_GB2312", Font.BOLD, 28), Color.BLACK);
		inputBox.setBorder(border);
	}

	private void bottomBoxSetting() {
		ActionListener time = new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispTime.setText(new java.util.Date().toString());
			}
		};
		new Timer(1000, time).start();

		bottomBox = Box.createHorizontalBox();
		dispTime = new JLabel();
		dispTime.setHorizontalAlignment(JLabel.LEFT);
		dispTime.setForeground(Color.BLACK);

		position.setHorizontalAlignment(JLabel.RIGHT);
		position
				.setText("ctj_2制作   濟南大學   計算0207    2002091048    &^-^&       ");

		bottomBox.add(position);
		bottomBox.add(dispTime);
	}

	public void actionPerformed(ActionEvent e) {
		String ip = ipField.getText().trim();
		String user = userField.getText().trim();
		String pass = passField.getText().trim();
		
                                          
		if (e.getSource() == callIP) {    // 呼叫服務器

			if (socket != null && in != null && out != null) // 消除以往的連接信息
			{
				try {
					socket.close();
					in.close();
					out.close();

				} catch (Exception ee) {

				}
			}

			String login = user + "," + pass;
			int port1 = 8001;                    
			
			try {                                         // 建立網絡連接
				socket = new Socket(ip, port1);
				in = new DataInputStream(socket.getInputStream());
				out = new DataOutputStream(socket.getOutputStream());
				out.writeUTF(login);
			} catch (IOException ee) // 如果連接失敗
			{
				ipField.setText("呼叫失敗");
				stateField.setText("你呼叫沒有成功");
			}
			if (socket != null) // 如果連接成功,對返回信息進行分析;
			{

				try {
					String loginInfo = in.readUTF().trim();   // 返回的信息

					if (!loginInfo.equals("用戶已經完成考試,不能再考試")) {

						stateField.setText(loginInfo);
						if (!loginInfo.equals("密碼錯誤")) {

							stateField.setText(loginInfo);
							if (loginInfo.equals("已經達到最大連接數")) {
								otherinfo.setText(loginInfo);
								stateField.setText(loginInfo);
								out.close();
								in.close();
								return;
							} else {                                // 成功登錄
								stuinfo.setText(loginInfo+",\n你的學生號為:" + user);
								stateField.setText(loginInfo);
								queryButton.setEnabled(true);
								beginExe.setEnabled(true);

								out.close();
								in.close();
							}
						} else {
							stateField.setText(loginInfo);
							passField.setText("");
							userField.setText("請重新輸入用戶名和密碼!");
						}
					} else {
						stateField.setText(loginInfo);
						queryButton.setVisible(true);
					}

				} catch (IOException e1) {
					e1.printStackTrace();
				}

			}

		} else if (e.getSource() == queryButton) { // 查詢學生信息
			stuinfo.setText("你正在查詢,請稍候");

			int port4 = 8004;
			try {
				socket = new Socket(ip, port4);
				in = new DataInputStream(socket.getInputStream());
				out = new DataOutputStream(socket.getOutputStream());

				out.writeUTF(user);
				stuinfo.setText("請求信息已發送");
			} catch (IOException ee) // 如果連接失敗
			{
				ipField.setText("呼叫失敗");
				stateField.setText("你呼叫沒有成功");
				stuinfo.setText("你呼叫沒有成功");
			}

			if (socket != null) // 如果連接成功
			{

				try {
					String queryInfo = in.readUTF();                // 得到查詢結果
					stuinfo.setText(queryInfo);

					out.flush();
					out.close();

				} catch (IOException e1) {                         // 出現異常
					otherinfo.setText("數據傳輸錯誤");
				}

			}

		} else if (e.getSource() == beginExe) { // 生成試題
			String mgr = (String) subject.getSelectedItem();

			if (mgr.equals("英語")) {              // 選擇英語
				selectT("e");
			} else if (mgr.equals("數學")) {      // 選擇數學
				selectT("m");

			}
			stateField.setText("你已經選擇了" + mgr + "試題");
			testinfo.setText("你已經選擇了" + mgr + "試題");

			startTest.setEnabled(true);

		} else if (e.getSource() == startTest) { // 開始考試

			stateField.setText("考試開始,時鐘計時");
			timeFlag = true;
			start();
			testArea.setText(tempTest[0]);
			startTest.setEnabled(false);
			beginExe.setEnabled(false);
			readNext.setEnabled(true);
			previous.setEnabled(false);
			search.setEnabled(false);
			next.setEnabled(false);

		} else if (e.getSource() == readNext) { // 讀下一題目
			tempStr1 = keyField.getText().trim();
			uanswer += tempStr1 + "@";

			if (n <= enu-1) {
				System.out.println(tempStr1);

				stateField.setText("第" + n + "題,你選擇的答案是:" + tempStr1); 
		    
				++n;
		// 顯示下一題

				testArea.setText(tempTest[num]);
				++num;
			} else {
				JOptionPane.showMessageDialog(null, "你已經答題完畢,請檢查后提交!",
						"確認完畢對話框", JOptionPane.INFORMATION_MESSAGE);
				readNext.setEnabled(false);
				preview.setEnabled(true);
				submit.setEnabled(true);
			}

		} else if (e.getSource() == preview) {              // 預覽
			answerinfo.setText("用戶:" + user + ", 你選的試題為:" + sub + "\n答題個數為:" + enu
					+ " 你的答案為:" + uanswer);
		} else if (e.getSource()==search){
			String testnum = JOptionPane.showInputDialog(null,"請輸入你要查詢的題目號");
			if(testnum==null){
				  System.out.println("出錯了");
				  return ;
			}else{                                                  // 查詢HashMap搜索相應的題目號,將對應試題顯示??????
				
			}
			
			
		}
			else if (e.getSource() == submit) {                  // 提交答案
		
				if (socket != null && in != null && out != null) // 消除以往的連接信息
				try {
					socket.close();
					in.close();
					out.close();

				} catch (Exception ee) {
					System.out.print("消除以往的連接");
				}

			try {
				socket = new Socket(ip, port3);
				in = new DataInputStream(socket.getInputStream());
				out = new DataOutputStream(socket.getOutputStream());
				out.writeUTF(user + "," + sub + "," + uanswer + "," + enu);

				stateField.setText("你已經提交完畢,請點擊查看分數");
				testinfo.setText("你已經提交完畢,請點擊查看分數");

			} catch (UnknownHostException e1) {
				stateField.setText("未找到服務器");
			} catch (IOException e1) {
				stateField.setText("數據傳輸出錯");
			}
			timeFlag = false;
			lookScore.setEnabled(true);

		} else if (e.getSource() == lookScore) {                     // 查看分數

			try {

				String s;
				s = in.readUTF().trim();

				StringBuffer sb = new StringBuffer(s);
				String s1 = sb.toString();
				JOptionPane.showMessageDialog(null, "用戶:" + user + "你的得分為:"
						+ s1, "查詢分數對話框", JOptionPane.INFORMATION_MESSAGE);
				stuinfo.setText("用戶:" + user + "你的得分為:" + s1);

				in.close();
				
				
				

				 submit.setEnabled(false);
	             preview.setEnabled(false);
	             readNext.setEnabled(false);
	            
				
				int temp = JOptionPane.showConfirmDialog(null, "您確認要關閉嗎?",
						"考試完畢,退出系統!", JOptionPane.YES_NO_OPTION);
				if (temp == JOptionPane.YES_OPTION) {
			    System.exit(0);

				} else if (temp == JOptionPane.NO_OPTION) {
					return;
				}
				
			} catch (IOException e1) {
				e1.printStackTrace();
			}
		
			
            


        
        } else if (e.getSource() == stuLog) {                 // 學生登錄
			enterButton.setEnabled(true);
		} else if (e.getSource() == techLog) { // 教師登錄
			JFrame.setDefaultLookAndFeelDecorated(true);
		      new TechGui();
			jf.setVisible(false);
		} else if (e.getSource() == enterButton) {            // 學生進入考試
			inputBox.setVisible(true);
		} else if (e.getSource() == version) {                  // 查看版本信息
			JOptionPane.showMessageDialog(null, "ctj_2制作    &^-^& ",
					"version1.0", JOptionPane.INFORMATION_MESSAGE);

		} else if (e.getSource() == exit || e.getSource() == exitButton) {  // 離開本系統

			int temp = JOptionPane.showConfirmDialog(null, "您已經考試完畢,請退出本系統!",
					"關閉系統!?", JOptionPane.YES_NO_OPTION);
			if (temp == JOptionPane.YES_OPTION) {
				System.exit(0);

			} else if (temp == JOptionPane.NO_OPTION) {
				return;
			}

		}

	}

	
	public void run() {

		--minute;

		while (minute >= 0 && timeFlag) {
			try {
				sleep(1000);
			} catch (InterruptedException e) {
				System.out.println(e.getMessage());
				e.printStackTrace();
			}
			second--;
			if (second == 0) {
				minute--;
				second = 59;
			}
			lastTimeF.setText(Integer.toString(minute) + " : "
					+ Integer.toString(second));

			if (minute == 0 && second == 59) {
				JOptionPane.showMessageDialog(null, "離考試結束還有1分鐘,請抓緊答題!",
						"時間提示對話框", JOptionPane.INFORMATION_MESSAGE);
			}
			if (minute == 0 && second == 0) {

				System.exit(0);

			}
		}
	}

	public void selectT(String mgr) {
		tempTest = new String[100];

		String str1 = null, str2 = null;

		if (socket != null && in != null && out != null) // 消除以往的連接信息
			try {
				socket.close();
				in.close();
				out.close();
			} catch (Exception ee) {
				otherinfo.setText("消除以往的連接");
			}

		try {
			socket = new Socket(ip, port2);
			in = new DataInputStream(socket.getInputStream());
			out = new DataOutputStream(socket.getOutputStream());
			sub = mgr;
			testArea.setText("");

			stateField.setText(in.readUTF());
			out.writeUTF(sub);
			System.out.println("發送成功");

			// 接收服務器傳送來的題目數量
			str1 = in.readUTF();
			enu = Integer.parseInt(str1);

			System.out.println(Integer.toString(enu));// 顯示題目數量

			// 接收服務器傳過來的試題
			str2 = in.readUTF();
			System.out.println("試題:" + str2);

			StringTokenizer stc = new StringTokenizer(str2, "^");

			for (int i = 0; i <= enu; i++) {
				String s = "";
				if (stc.hasMoreTokens()) {

					tempTest[i] = stc.nextToken().trim();

				}
				System.out.println("第" + i + "題\n" + tempTest[i]);
			}

			minute = Integer.parseInt(in.readUTF());

			out.flush();
			out.close();
		} catch (NumberFormatException e) {
			otherinfo.setText("數據傳輸格式錯誤");
		} catch (UnknownHostException e) {
			otherinfo.setText("未找到服務器");
		} catch (IOException e) {
			otherinfo.setText("數據傳輸錯誤");
		}

	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91黄色激情网站| 色噜噜狠狠一区二区三区果冻| 不卡在线视频中文字幕| 精品国产免费人成在线观看| 日本亚洲电影天堂| 久久久精品国产免大香伊| 国产成人精品免费网站| 国产精品传媒入口麻豆| 欧美日韩在线播放一区| 国产原创一区二区三区| 国产精品你懂的在线| 日本韩国视频一区二区| 久久电影国产免费久久电影| 久久久久久久国产精品影院| 在线观看精品一区| 国产综合成人久久大片91| 亚洲影院理伦片| 久久久久久久电影| 日韩一区二区三区电影| 色成人在线视频| 成人av在线资源网| 国产一区二区三区不卡在线观看 | av中文字幕不卡| 精品在线一区二区三区| 午夜精品成人在线视频| 亚洲日本一区二区三区| 国产拍揄自揄精品视频麻豆| 欧美一区二区三区在线观看| 91欧美激情一区二区三区成人| 国产在线视频不卡二| 美女网站一区二区| 蜜桃视频第一区免费观看| 亚洲国产日韩av| 五月婷婷久久丁香| 午夜电影网一区| 亚洲国产中文字幕| 亚洲一区二区黄色| 亚洲激情av在线| 亚洲综合清纯丝袜自拍| 亚洲图片一区二区| 久久国产精品99久久久久久老狼| 日产国产欧美视频一区精品 | 亚洲激情六月丁香| 樱花影视一区二区| 婷婷激情综合网| 国产一区二区调教| 不卡的av中国片| 91福利区一区二区三区| 欧美日韩视频在线观看一区二区三区| 欧美日韩一区在线观看| 欧美一级片在线| 色综合久久天天综合网| 精品综合免费视频观看| 亚洲一级二级三级在线免费观看| 亚洲免费av高清| 国产一区二三区好的| 在线观看亚洲精品视频| 久久夜色精品一区| 亚洲已满18点击进入久久| 久久99精品久久久久久国产越南| 成人黄色电影在线| 欧美成人精品3d动漫h| 中文字幕亚洲不卡| 国产乱子伦视频一区二区三区 | 日韩一区二区免费在线电影| 亚洲国产精品精华液2区45| 视频一区二区国产| 在线一区二区三区四区五区 | 亚洲人吸女人奶水| 国产精品一区二区果冻传媒| 精品国产成人系列| 久久精品国产在热久久| 精品久久久三级丝袜| 男女视频一区二区| 欧美一级日韩一级| 国产综合久久久久久久久久久久| 91精品国产色综合久久不卡蜜臀| 亚洲不卡av一区二区三区| 日本乱人伦一区| 一区二区视频免费在线观看| 99精品欧美一区二区蜜桃免费| 中文字幕第一区综合| 成人app在线| 亚洲综合视频在线| 精品久久久久久亚洲综合网 | 国产在线播放一区| 久久久久国产精品厨房| 色八戒一区二区三区| 天天综合色天天综合色h| 国产午夜精品理论片a级大结局| 国产美女久久久久| 亚洲一区在线观看视频| 日韩欧美不卡在线观看视频| 国产呦精品一区二区三区网站| 亚洲人成小说网站色在线| 欧美精品一二三区| 成人黄色在线视频| 蜜芽一区二区三区| 一区免费观看视频| 精品国产免费人成电影在线观看四季 | 欧美激情一区二区三区四区| 色88888久久久久久影院野外| 狠狠色丁香婷婷综合| 亚洲成年人网站在线观看| 国产喷白浆一区二区三区| 日韩写真欧美这视频| 色又黄又爽网站www久久| 国产一区二区三区久久久| 亚洲1区2区3区4区| 一区二区三区久久久| 久久精品一区二区三区不卡| 26uuu亚洲| 亚洲精品在线观| 91捆绑美女网站| 亚洲综合在线观看视频| 欧美r级电影在线观看| 欧美日韩国产天堂| 欧美系列日韩一区| 精品视频免费看| 欧美日韩大陆一区二区| 欧美私人免费视频| 欧美疯狂做受xxxx富婆| 欧美日韩国产精品成人| 日韩一级片在线播放| 日韩一卡二卡三卡| 久久精品视频一区| 国产精品青草综合久久久久99| 久久精品视频免费观看| 日韩理论电影院| 亚洲资源中文字幕| 美女视频一区二区三区| 成人99免费视频| 在线电影一区二区三区| 久久综合色8888| 亚洲精品高清在线观看| 国产一区999| 欧美午夜片在线看| 国产视频不卡一区| 日本最新不卡在线| av电影一区二区| 欧美成人性战久久| 中文字幕亚洲区| 国产精品一区二区不卡| 欧美日韩高清在线播放| 国产精品国产a| 看电影不卡的网站| 欧美天堂亚洲电影院在线播放| 国产人成亚洲第一网站在线播放| 午夜精品久久久久久久99樱桃| 国产99精品国产| 久久久噜噜噜久噜久久综合| 奇米777欧美一区二区| 欧日韩精品视频| 亚洲黄网站在线观看| 91麻豆成人久久精品二区三区| 精品粉嫩aⅴ一区二区三区四区| 日本伊人色综合网| 日韩精品专区在线影院观看| 首页国产欧美日韩丝袜| 欧美丰满美乳xxx高潮www| 一区二区欧美国产| 欧美最猛黑人xxxxx猛交| 一区二区三区不卡视频| 色香色香欲天天天影视综合网| 亚洲欧美日韩一区二区三区在线观看| 成人av动漫网站| 性感美女极品91精品| 欧美二区乱c少妇| 久久66热偷产精品| 久久精品一级爱片| 在线视频国产一区| 日韩精品一二三四| 国产偷国产偷亚洲高清人白洁| 国产美女视频一区| 亚洲愉拍自拍另类高清精品| 欧美另类videos死尸| 国产九九视频一区二区三区| 日韩美女啊v在线免费观看| 欧美精品123区| 99精品热视频| 国产综合久久久久影院| 亚洲高清中文字幕| 国产精品久久久久久久久免费樱桃 | 欧美日韩国产免费| 国产成人av电影在线观看| 亚洲国产精品欧美一二99| 久久青草欧美一区二区三区| 欧美性感一区二区三区| 成人国产视频在线观看| 看电视剧不卡顿的网站| 亚洲午夜激情av| 亚洲男人的天堂一区二区 | 国产精品久久久久三级| 久久一夜天堂av一区二区三区| 在线精品亚洲一区二区不卡| 国产精品一区二区久久精品爱涩 | gogo大胆日本视频一区| 国产精选一区二区三区| 国产精品综合网| 国产美女视频一区|