資源簡介
里面有該程序的源源文件代碼及背景圖片
如有不足之處還請大家多多指教!

代碼片段和文件信息
import?java.awt.Font;
import?java.awt.TextArea;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.io.BufferedReader;
import?java.io.IOException;
import?java.io.PrintWriter;
import?java.net.URL;
import?javax.swing.ImageIcon;
import?javax.swing.JButton;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
//兩個按鈕添加事件
public?class?Liaotian?extends?Jframe?implements?ActionListener?Runnable?{
private?PrintWriter?out;
private?BufferedReader?in;
JLabel?jj?jj1jj2?jl1?jl2?jl3;
TextArea?jtf;
TextArea?jpf;
JButton?jb1?jb2?jb3;
//Sdzdk?sd?=?new?Sdzdk();
public?Liaotian(BufferedReader?in?PrintWriter?out)?{
super(“與?客戶機?聊天中“);
this.out?=?out;
this.in=in;
setLayout(null);
jj=new?JLabel(““);
????jj1=new?JLabel(““);
????jj2=new?JLabel(““);
jl1?=?new?JLabel(“來自對方的消息“);
jl1.setFont(new?Font(“隸書“?Font.BOLD?30));
jl2?=?new?JLabel(“要發送的內容“);
jl2.setFont(new?Font(“隸書“?Font.BOLD?30));
jtf?=?new?TextArea(500?800);
jpf?=?new?TextArea(5?80);
jb3?=?new?JButton(“聊天記錄“);
jb1?=?new?JButton(“發送“);
jb2?=?new?JButton(“離線“);
jb2.addActionListener(this);
jb1.addActionListener(this);
//添加圖片
???? jj?=?new?JLabel();
???? URL?resource?=?this.getClass().getResource(“/image/2.png“);
???? ImageIcon?bgImage=new?ImageIcon(resource);
???? jj.setIcon(bgImage);?
???? jj.setBounds(0020010);
????
???? jj1?=?new?JLabel();
???? URL?resource1?=?this.getClass().getResource(“/image/1.png“);
???? ImageIcon?bgImage1=new?ImageIcon(resource1);
???? jj1.setIcon(bgImage1);?
???? jj1.setBounds(0350300200);
????
????
???? jj2?=?new?JLabel();
???? URL?resource2?=?this.getClass().getResource(“/image/5.jpg“);
???? ImageIcon?bgImage2=new?ImageIcon(resource2);
???? jj2.setIcon(bgImage2);?
???? jj2.setBounds(00800700);
????
//?以下是設置jjjl1jl2jb1jb2jtfjpf的位置及大小代碼
???? jj.setBounds(600?35?300?200);
????????jj1.setBounds(600?350?300?200);
????????jj2.setBounds(0?0?800?700);
jl1.setBounds(10?10?330?30);
jtf.setBounds(10?40?530200);
jl2.setBounds(10?320?330?30);
jpf.setBounds(10?350?530200);
jb1.setBounds(125?600?80?30);
jb2.setBounds(220?600?80?30);
jb3.setBounds(10?600?100?30);
//?this.add(jj);
this.add(jl1);
this.add(jl2);
this.add(jtf);
this.add(jpf);
this.add(jb1);
this.add(jb2);
this.add(jb3);
this.add(jj);
this.add(jj1);
???? this.add(jj2);
this.setBounds(100?100?800?700);
this.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
this.setVisible(true);
new?Thread(this).start();
}
public?void?actionPerformed(ActionEvent?e)?{
if?(e.getActionCommand().equals(“離線“))?{
if?(this.out?!=?null)?{
this.out.println(“我要離線,請不要發了“);
this.out.println(“bye“);
this.out?=?null;
}
jtf.append(“我離線\n“);
}?
else?{//?發送
if?(this.out?!=?null)?{
//System.out.println(jpf.getText());
this.out.println(
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????215??2011-06-26?11:14??click?and?seaver\使用必讀.txt
?????文件??????62979??2011-06-25?11:37??click?and?seaver\源文件\bin\image\1.png
?????文件??????42517??2011-06-25?11:37??click?and?seaver\源文件\bin\image\2.png
?????文件??????55429??2011-06-25?11:37??click?and?seaver\源文件\bin\image\5.jpg
?????文件????1183254??2011-06-25?11:37??click?and?seaver\源文件\bin\image\6.bmp
?????文件??????78084??2011-06-25?11:37??click?and?seaver\源文件\bin\image\7.jpg
?????文件???????4157??2011-06-25?16:07??click?and?seaver\源文件\bin\Liaotian.class
?????文件???????4217??2011-06-25?09:12??click?and?seaver\源文件\bin\Lt.class
?????文件???????4681??2011-06-25?09:06??click?and?seaver\源文件\bin\M.class
?????文件???????4986??2011-06-25?16:07??click?and?seaver\源文件\bin\Sdzdk.class
?????文件???????2479??2011-06-25?16:07??click?and?seaver\源文件\bin\Yhdl.class
?????文件???????3497??2011-06-25?11:35??click?and?seaver\源文件\src\Liaotian.java
?????文件???????3430??2011-06-25?09:12??click?and?seaver\源文件\src\Lt.java
?????文件???????3947??2011-06-25?09:06??click?and?seaver\源文件\src\M.java
?????文件???????3876??2011-06-25?11:35??click?and?seaver\源文件\src\Sdzdk.java
?????文件???????2775??2011-06-25?10:05??click?and?seaver\源文件\src\Yhdl.java
?????目錄??????????0??2011-06-25?17:45??click?and?seaver\源文件\bin\image
?????目錄??????????0??2011-06-25?17:45??click?and?seaver\源文件\bin
?????目錄??????????0??2011-06-25?17:45??click?and?seaver\源文件\src
?????目錄??????????0??2011-06-25?09:51??click?and?seaver\源文件
?????目錄??????????0??2011-06-26?11:13??click?and?seaver
-----------?---------??----------?-----??----
??????????????1460523????????????????????21
評論
共有 條評論