资源简介
适合不懂的java初学者 java带聊天的五子棋 适合新手 下载吧
代码片段和文件信息
package ChatOneToOneClient;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JButton;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import ChatOneToOneClient.ClientComponentPopupMenu;
public class ChatOneToOneClient extends Jframe{
/**
*
*/
private static final long serialVersionUID = 1L;
ClientMyDialog clientDialog;
Container contentPane;
JButton clientBtn;
JTextArea ta;
JLabel inputIP;
JTextField tfaddresstfporttftype;
int port;
Clientskt client;
static ChatOneToOneClient frm;
JScrollPane pane ;
JPanel northsouthcentereastwest;
ClientChessPanel chessPanel;
public ChatOneToOneClient(){
contentPane=getContentPane();
north=new JPanel();
south=new JPanel();
center=new JPanel();
east=new JPanel();
west=new JPanel();
inputIP=new JLabel(“请输入IP:“);
clientBtn=new JButton(“连接“);
ta=new JTextArea(2015);
tfaddress=new JTextField(9);
tfport=new JTextField(“8888“);
tfport.setEditable(false);
tftype=new JTextField(50);
pane=new JScrollPane(ta);
ta.setEditable(false);
tftype.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if(e.getKeyCode()==KeyEvent.VK_ENTER){
ta.append(“自己>“+tftype.getText()+“\n“);
ta.setCaretPosition(ta.getText().length());
client.dataout(“chat:用户端:“+tftype.getText());
tftype.setText(““);
}
}
});
clientBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
port=Integer.parseInt(tfport.getText());
client =new Clientskt(tfaddress.getText()portfrm);
client.start();
contentPane.add(tftypeBorderLayout.SOUTH);
chessPanel=new ClientChessPanel(2030client);
tfaddress.setEditable(false);
clientBtn.setEnabled(false);
contentPane.add(chessPanelBorderLayout.CENTER);
contentPane.validate();
}
});
tftype.addMouseListener(ClientComponentPopupMenu.getSharedInstance());
ta.addMouseListener(ClientComponentPopupMenu.getSharedInstance());
north.add(inputIP);
north.add(tfaddress);
north.add(tfport);
north.add(clientBtn);
contentPane.setLayout(new BorderLayout());
contentPane.add(northBorderLayout.NORTH);
contentPane.add(paneBorderLayout.WEST);
setSize(800 700);
settitle(“客服端“);
setDefaultCloseOperat
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2011-09-05 20:19 ChatOneToOneClient\.classpath
文件 394 2011-09-05 20:19 ChatOneToOneClient\.project
文件 629 2011-09-05 20:19 ChatOneToOneClient\.settings\org.eclipse.jdt.core.prefs
文件 1707 2011-09-07 22:47 ChatOneToOneClient\bin\ChatOneToOneClient\ChatOneToOneClient$1.class
文件 1828 2011-09-07 22:47 ChatOneToOneClient\bin\ChatOneToOneClient\ChatOneToOneClient$2.class
文件 3003 2011-09-07 22:47 ChatOneToOneClient\bin\ChatOneToOneClient\ChatOneToOneClient.class
文件 2278 2011-09-07 23:26 ChatOneToOneClient\bin\ChatOneToOneClient\ClientChessPanel$1.class
文件 4047 2011-09-07 23:26 ChatOneToOneClient\bin\ChatOneToOneClient\ClientChessPanel.class
文件 5526 2011-09-05 22:15 ChatOneToOneClient\bin\ChatOneToOneClient\ClientComponentPopupMenu.class
文件 796 2011-09-07 23:31 ChatOneToOneClient\bin\ChatOneToOneClient\ClientMyDialog$1.class
文件 1430 2011-09-07 23:31 ChatOneToOneClient\bin\ChatOneToOneClient\ClientMyDialog.class
文件 3965 2011-09-07 23:28 ChatOneToOneClient\bin\ChatOneToOneClient\Clientskt.class
文件 3154 2011-09-07 22:47 ChatOneToOneClient\src\ChatOneToOneClient\ChatOneToOneClient.java
文件 4620 2011-09-07 23:26 ChatOneToOneClient\src\ChatOneToOneClient\ClientChessPanel.java
文件 7683 2011-09-05 22:15 ChatOneToOneClient\src\ChatOneToOneClient\ClientComponentPopupMenu.java
文件 1193 2011-09-07 23:31 ChatOneToOneClient\src\ChatOneToOneClient\ClientMyDialog.java
文件 2503 2011-09-07 23:28 ChatOneToOneClient\src\ChatOneToOneClient\Clientskt.java
文件 301 2011-09-05 20:28 ChatOneToOneServer\.classpath
文件 394 2011-09-05 20:28 ChatOneToOneServer\.project
文件 629 2011-09-05 20:28 ChatOneToOneServer\.settings\org.eclipse.jdt.core.prefs
文件 1707 2011-09-07 22:51 ChatOneToOneServer\bin\ChatOneToOneServer\ChatOneToOneServer$1.class
文件 1723 2011-09-07 22:51 ChatOneToOneServer\bin\ChatOneToOneServer\ChatOneToOneServer$2.class
文件 3602 2011-09-07 22:51 ChatOneToOneServer\bin\ChatOneToOneServer\ChatOneToOneServer.class
文件 2278 2011-09-07 23:23 ChatOneToOneServer\bin\ChatOneToOneServer\ServerChessPanel$1.class
文件 4035 2011-09-07 23:23 ChatOneToOneServer\bin\ChatOneToOneServer\ServerChessPanel.class
文件 5526 2011-09-05 22:16 ChatOneToOneServer\bin\ChatOneToOneServer\ServerComponentPopupMenu.class
文件 796 2011-09-07 23:30 ChatOneToOneServer\bin\ChatOneToOneServer\ServerMyDialog$1.class
文件 1430 2011-09-07 23:30 ChatOneToOneServer\bin\ChatOneToOneServer\ServerMyDialog.class
文件 4170 2011-09-07 23:29 ChatOneToOneServer\bin\ChatOneToOneServer\Serverskt.class
文件 3778 2011-09-07 22:51 ChatOneToOneServer\src\ChatOneToOneServer\ChatOneToOneServer.java
............此处省略19个文件信息
评论
共有 条评论