新聞中心
我有一個基于JAVA的企業(yè)QQ源程序,但是不知道怎么運行,誰能幫幫我啊~!
你說了一些你想說什么啊 不就是想說 有一個程序代碼 你想運行看到結(jié)果嗎 ?DOS黑屏下運行時最基本最簡單的 . 我交你一個萬能方法吧
創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比岫巖網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式岫巖網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋岫巖地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。
1.下一個myeclipse 而不是eclipse 有很大區(qū)別的
2.裝完之后 進入軟件里 右擊新建工程
3.在工程建立后 右擊工程 建立class文件 之后把你的代碼復(fù)制粘貼到里面
4,。菜單欄里德運行按鈕 就可以了(前提是你的代碼是正確無誤的)
不會可以叫我 截圖 在線教你
關(guān)于仿QQ聊天對話框的JAVA代碼
1、swing的界面可以直接用netbeans畫出來嘛。
2、可以把輸出的聊天內(nèi)容都放在一個StringBuffer里,每打出一句話,就把這句話追加在StringBuffer,然后把StringBuffer里的內(nèi)容輸出到Textarea中。
3、好友列表可以用JList
有誰知道QQ后臺程序用JAVA怎么編寫啊?
import java.io.*;
public class QQ_Manager {
private int max_user=1000;
private String[] userID;
private String[] userName;
private String[] userPW;
private String[] userIP;
private int userCounts;
private int userOnline;
private String fileName;
/**構(gòu)造方法初始化數(shù)據(jù)文件等*/
QQ_Manager(String fileName){this.fileName=fileName;}
/**將現(xiàn)有的QQ用戶和記錄寫入數(shù)據(jù)文件*/
public synchronized void write_userDataFile(String fileName) {
}
/**從數(shù)據(jù)文件中讀取QQ用戶記錄*/
public synchronized void read_userDataFile(String fileName) {
}
/**用戶來注冊新的QQ號*/
public synchronized boolean regist_QQ(String userName,String PW){return false;}
/**QQ用戶登陸處理*/
public synchronized boolean login_QQ(String id,String pw){return true;}
/**QQ用戶離線處理*/
public synchronized boolean logout_QQ(String id, String pw){return false;}
/**返回QQ在線列表*/
public String get_QQList(){return null;}
}
求一個山寨qq的源代碼,要java語言的~謝謝
簡單得很的那種要不要?就像用來應(yīng)對考試一樣。
import?java.io.*;
import?java.net.*;
import?java.util.*;
public?class?ChatServer?{
boolean?started?=?false;
ServerSocket?ss?=?null;
ListClient?clients?=?new?ArrayListClient();
public?static?void?main(String[]?args)?{
new?ChatServer().start();
}
public?void?start()?{
try?{
ss?=?new?ServerSocket(8888);
started?=?true;
}?catch?(BindException?e)?{
System.out.println("端口使用中....");
System.out.println("請關(guān)掉相關(guān)程序并重新運行服務(wù)器!");
System.exit(0);
}?catch?(IOException?e)?{
e.printStackTrace();
}?
try?{?
while(started)?{
Socket?s?=?ss.accept();
Client?c?=?new?Client(s);
System.out.println("a?client?connected!");
new?Thread(c).start();
clients.add(c);
}
}?catch?(IOException?e)?{
e.printStackTrace();
}?finally?{
try?{
ss.close();
}?catch?(IOException?e)?{
e.printStackTrace();
}
}
}
class?Client?implements?Runnable?{
private?Socket?s;
private?DataInputStream?dis?=?null;
private?DataOutputStream?dos?=?null;
private?boolean?bConnected?=?false;
public?Client(Socket?s)?{
this.s?=?s;
try?{
dis?=?new?DataInputStream(s.getInputStream());
dos?=?new?DataOutputStream(s.getOutputStream());
bConnected?=?true;
}?catch?(IOException?e)?{
e.printStackTrace();
}
}
public?void?send(String?str)?{
try?{
dos.writeUTF(str);
}?catch?(IOException?e)?{
e.printStackTrace();
}
}
public?void?run()?{
try?{
while(bConnected)?{
String?str?=?dis.readUTF();
System.out.println(str);
for(int?i=0;?iclients.size();?i++)?{
Client?c?=?clients.get(i);
c.send(str);
}
}
}?catch?(EOFException?e)?{
System.out.println("Client?closed!");
}?catch?(IOException?e)?{
e.printStackTrace();
}?finally?{
try?{
if(dis?!=?null)?dis.close();
if(dos?!=?null)?dos.close();
if(s?!=?null)??{
s.close();
//s?=?null;
}
}?catch?(IOException?e1)?{
e1.printStackTrace();
}
}
}
}
}
客戶端,開兩個就能聊了……
import?java.awt.*;
import?java.awt.event.*;
import?java.io.*;
import?java.net.*;
public?class?ChatClient?extends?Frame?{
Socket?s?=?null;
DataOutputStream?dos?=?null;
DataInputStream?dis?=?null;
private?boolean?bConnected?=?false;
TextField?tfTxt?=?new?TextField();
TextArea?taContent?=?new?TextArea();
Thread?tRecv?=?new?Thread(new?RecvThread());
public?static?void?main(String[]?args)?{
new?ChatClient().launchFrame();?
}
public?void?launchFrame()?{
setLocation(400,?300);
this.setSize(300,?300);
add(tfTxt,?BorderLayout.SOUTH);
add(taContent,?BorderLayout.NORTH);
pack();
this.addWindowListener(new?WindowAdapter()?{
@Override
public?void?windowClosing(WindowEvent?arg0)?{
disconnect();
System.exit(0);
}
});
tfTxt.addActionListener(new?TFListener());
setVisible(true);
connect();
tRecv.start();
}
public?void?connect()?{
try?{
s?=?new?Socket("127.0.0.1",?8888);
dos?=?new?DataOutputStream(s.getOutputStream());
dis?=?new?DataInputStream(s.getInputStream());
System.out.println("connected!");
bConnected?=?true;
}?catch?(UnknownHostException?e)?{
e.printStackTrace();
}?catch?(IOException?e)?{
e.printStackTrace();
}
}
public?void?disconnect()?{
try?{
dos.close();
dis.close();
s.close();
}?catch?(IOException?e)?{
e.printStackTrace();
}
}
private?class?TFListener?implements?ActionListener?{
public?void?actionPerformed(ActionEvent?e)?{
String?str?=?tfTxt.getText().trim();
tfTxt.setText("");
try?{
dos.writeUTF(str);
dos.flush();
}?catch?(IOException?e1)?{
e1.printStackTrace();
}
}
}
private?class?RecvThread?implements?Runnable?{
public?void?run()?{
try?{
while(bConnected)?{
String?str?=?dis.readUTF();
taContent.setText(taContent.getText()?+?str?+?'\n');
}
}?catch?(SocketException?e)?{
System.out.println("bye!");
}?catch?(IOException?e)?{
e.printStackTrace();
}?
}
}
}
本文名稱:qq的java程序源代碼 java實現(xiàn)
當前網(wǎng)址:http://www.dlmjj.cn/article/dojsphd.html