資源簡介
運行前先看說明,文件列表:
123.txt 804 18-12-05|13:17
ChoiceFile.class 2916 18-12-05|13:06
ChoiceFile.java 2721 09-12-03|09:12
Client$1.class 474 31-03-09|15:07
Client.class 4315 31-03-09|15:07
Client.java 3834 09-12-03|09:10
ClientTestArea.class 5216 18-12-05|13:06
ClientTestArea.java 6260 09-12-03|09:12
FileName.class 640 31-03-09|15:06
ReadTestquestion.class 3058 18-12-05|13:06
ReadTestquestion.java 3853 21-12-03|23:02
Server.class 1036 31-03-09|15:06
Server.java 4303 09-12-03|09:05
Server_thread.class 2922 31-03-09|15:06
說明.doc 52224 31-
03-09|15:04
cs結構的考試系統 0 31-03-09|16:52
123.txt 804 18-12-05|13:17
ChoiceFile.class 2916 18-12-05|13:06
ChoiceFile.java 2721 09-12-03|09:12
Client$1.class 474 31-03-09|15:07
Client.class 4315 31-03-09|15:07
Client.java 3834 09-12-03|09:10
ClientTestArea.class 5216 18-12-05|13:06
ClientTestArea.java 6260 09-12-03|09:12
FileName.class 640 31-03-09|15:06
ReadTestquestion.class 3058 18-12-05|13:06
ReadTestquestion.java 3853 21-12-03|23:02
Server.class 1036 31-03-09|15:06
Server.java 4303 09-12-03|09:05
Server_thread.class 2922 31-03-09|15:06
說明.doc 52224 31-
03-09|15:04
cs結構的考試系統 0 31-03-09|16:52
代碼片段和文件信息
import?java.awt.*;
import?javax.swing.*;
import?java.awt.event.*;
import?java.io.*;
import?java.net.*;
public?class?ChoiceFile?extends?Panel?implements?ItemListenerActionListenerRunnable
{
???Button?得到試題文件=null;
???Choice?list=null;?
???Socket??socket=null;
???DataInputStream?in=null;?
???DataOutputStream?out=null;?
???Thread?thread=null;
???boolean?success=false?isSelected=false;
???int?n=0;
???
???public?ChoiceFile()
????{
??????得到試題文件=new?Button(“將試題文件添加到下拉列表中“);
??????得到試題文件.setEnabled(false);
??????得到試題文件.addActionListener(this);
??????list=new?Choice();
??????list.add(“**********“);
??????add(得到試題文件);
??????add(list);
??????list.addItemListener(this);
??????thread=new?Thread(this);
????}
??public?void?setSocketConnection(Socket?socketDataInputStream?inDataOutputStream?out)
????{
??????this.socket=socket;
??????this.in=in;
??????this.out=out;?
??????try?{
????????????thread.start();?
??????????}
??????catch(Exception?ee)
??????????{
??????????}
??????if(this.socket!=null)
???????{
?????????得到試題文件.setEnabled(true);
???????}?
????}
???public?void?actionPerformed(ActionEvent?e)
????{
?????????try?
???????????{?
?????????????out.writeUTF(“列出考試文件“);
???????????}
???????????catch(IOException?ee)
???????????{?
?????????????success=false;
???????????}
???????
????}?
??public?void?itemStateChanged(ItemEvent?e)
????{?
??????n=list.getItemCount();
??????if(n>=1&&isSelected==true)
????????{
??????????String?listItem=list.getSelectedItem();
???????????try
??????????????{
????????????????out.writeUTF(“考試文件的名字:“+listItem);
????????????????out.writeUTF(“請通知考試界面考試用時:“);
??????????????}
???????????catch(IOException?ee)
??????????????{
??????????????}
????????}?????????
???}
??public?String?得到選擇的文件名()
???{
????return?list.getSelectedItem();
???}
??public?void?run()
???{
????String?s=null;
????list.removeAll();
????while(true)
??????{?
????????try
???????????{
?????????????s=in.readUTF();??????????
??????????????if(s.startsWith(“考試文件:“))
?????????????????{
???????????????????String?listItem=s.substring(s.indexOf(“:“)+1);
???????????????????list.add(listItem);
???????????????????isSelected=true;
?????????????????}
???????????????if(s.startsWith(“已經全部列出:“))
?????????????????{
???????????????????success=true;?
???????????????????break;
?????????????????}
???????????????
???????????}
????????catch?(Exception?ee)?
???????????{
???????????}???
??????}
?}
?public?boolean?getSuccess()
?{?
???n=list.getItemCount();
???if(n>0&&success==true)
??????return?true;
???else
??????return?false;
?}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????804??2005-12-18?13:17??CS架構考試系統\123.txt
?????文件???????2916??2005-12-18?13:06??CS架構考試系統\ChoiceFile.class
?????文件???????2721??2003-12-09?09:12??CS架構考試系統\ChoiceFile.java
?????文件????????474??2009-03-31?15:07??CS架構考試系統\Client$1.class
?????文件???????4315??2009-03-31?15:07??CS架構考試系統\Client.class
?????文件???????3834??2003-12-09?09:10??CS架構考試系統\Client.java
?????文件???????5216??2005-12-18?13:06??CS架構考試系統\ClientTestArea.class
?????文件???????6260??2003-12-09?09:12??CS架構考試系統\ClientTestArea.java
?????文件????????640??2009-03-31?15:06??CS架構考試系統\FileName.class
?????文件???????3058??2005-12-18?13:06??CS架構考試系統\ReadTestquestion.class
?????文件???????3853??2003-12-21?23:02??CS架構考試系統\ReadTestquestion.java
?????文件???????1036??2009-03-31?15:06??CS架構考試系統\Server.class
?????文件???????4303??2003-12-09?09:05??CS架構考試系統\Server.java
?????文件???????2922??2009-03-31?15:06??CS架構考試系統\Server_thread.class
?????文件??????52224??2009-03-31?15:04??CS架構考試系統\說明.doc
?????目錄??????????0??2011-04-18?14:17??CS架構考試系統
-----------?---------??----------?-----??----
????????????????94576????????????????????16
評論
共有 條評論