package com.client.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.ImageIcon;
import javax.imageio.ImageIO;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import com.bin.client.Receive;
import com.bin.client.Send;
import com.bin.pojo.MessageBean;
import com.bin.pojo.ReceiveFileBean;
import com.bin.tools.FrameTool;
public class MainUi extends JFrame implements ActionListener,MouseListener {
private DialogFriend dialogFriend;
private boolean isInit=true; //是否是第一次打开会话窗口
private MessageBean message= new MessageBean();
private JButton flush;
private JComboBox friendList;
private String friend;
private JLabel tip;
private JPanel friendWindow;
private String user;
private JLabel userLabel;
private JPanel panel;
private boolean isExist=false;
private JButton send;
private JButton reset;
private Container con;
private JPanel infoPanel;
private Send clientSend;
private Receive receive;
InputStream in;
OutputStream out;
private Socket socket;
private TipDialog tipDialog;
private MyFileDialog openFile;
private JLabel sendFileInfo;
private JLayeredPane layerPanel;
private DialogFriend useDilog; //当前正在使用的会话窗口
private HashMap<JLabel, DialogFriend> friendLabels=new HashMap<JLabel, DialogFriend>();
public static JLabel useLabel; //与当前正在使用的会话窗口对应的Jlabel(窗口标题栏)
private JLabel friendLabel;
private JList friendJList;
private JLabel frinfo;
private MyCellRenderer myCell;
private ArrayList< MessageBean> huancunMessage;
int i;
JButton voiceChat,voiceStop;
public MyCellRenderer getMyCell() {
return myCell;
}
public void setMyCell(MyCellRenderer myCell) {
this.myCell = myCell;
}
public JList getFriendJList() {
return friendJList;
}
public void setFriendJList(JList friendJList) {
this.friendJList = friendJList;
}
private static final long serialVersionUID = 1L;
public DialogFriend getUseDilog() {
return useDilog;
}
public void setUseDilog(DialogFriend useDilog) {
this.useDilog = useDilog;
}
public HashMap<JLabel, DialogFriend> getFriendLabels() {
return friendLabels;
}
public void setFriendLabels(HashMap<JLabel, DialogFriend> friendLabels) {
this.friendLabels = friendLabels;
}
public DialogFriend getDialogFriend() {
return dialogFriend;
}
public void setDialogFriend(DialogFriend dialogFriend) {
this.dialogFriend = dialogFriend;
}
public String getFriend() {
return friend;
}
public void setFriend(String friend) {
this.friend = friend;
}
public JLabel getSendFileInfo() {
return sendFileInfo;
}
public void setSendFileInfo(JLabel sendFileInfo) {
this.sendFileInfo = sendFileInfo;
}
public Socket getSocket() {
return socket;
}
public void setSocket(Socket socket) {
this.socket = socket;
}
public Receive getReceive() {
return receive;
}
public void setReceive(Receive receive) {
this.receive = receive;
}
public Send getClientSend() {
return clientSend;
}
public void setClientSend(Send clientSend) {
this.clientSend = clientSend;
}
public MessageBean getMessage() {
return message;
}
public void setMessage(MessageBean message) {
this.message = message;
}
public JComboBox getFriendList() {
return friendList;
}
public void setFriendList(JComboBox friendList) {
this.friendList = friendList;
}
public JButton getSend() {
return send;
}
public void setSend(JButton send) {
this.send = send;
}
public JButton getReset() {
return reset;
}
public void setReset(JButton reset) {
this.reset = reset;
}
public JButton getvoiceChat(){
return voiceChat;
}
public void setvoiceChat(JButton voiceChat){
this.voiceChat=voiceChat;
}
public JButton getvoiceStop(){
return voiceStop;
}
public void setvoiceStop(JButton voiceStop){
this.voiceStop=voiceStop;
}
public JPanel getInfoPanel() {
return infoPanel;
}
public void setInfoPanel(JPanel infoPanel) {
this.infoPanel = infoPanel;
}
public TipDialog getTipDialog() {
return tipDialog;
}
public void setTipDialog(TipDialog tipDialog) {
this.tipDialog = tipDialog;
}
public MyFileDialog getOpenFile() {
return openFile;
}
public void setOpenFile(MyFileDialog openFile) {
this.openFile = openFile;
}
public MainUi(String user, ArrayList<String> friends) {
super("主界面");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e2) {
e2.printStackTrace();
}
this.user = user;
this.setResizable(false);
FrameTool.setWindowBackground(this, System.getProperty("user.dir")
+ "\\backImg.jpg");
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
try {
message = new MessageBean();
message.setType(-1);
clientSend.getMoos().writeObjectSelf(message);
clientSend.getMoos().close();
receive.getOis().close();
socket.close();
} catch (IOException e1) {
e1.printStackTrace();
}
System.exit(0);
}
});
con = this.getContentPane();
FrameTool.centerFrame(this, 700, 480);
frinfo=new JLabel("在线好友列表");
frinfo.setFont(new Font("宋体", 1, 16));
frinfo.setForeground(Color.orange);
frinfo.setBounds(525,30,150,20);
friendLabel=new JLabel("当前无会话");
friendLabel.setToolTipText("当前无会话");
friendLabel.setFont(new Font("楷体", 1, 14));
friendLabel.addMouseListener(this);
friendLabel.setOpaque(true);
friendLabel.setBackground(Color.gray);
friendWindow=new JPanel()
{
@Override
protected void paintComponent(Graphics g) {
try {
BufferedImage img=ImageIO.read(new File(System.getProperty("user.dir")+"\\windowlabel.png"));
g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(),
0, 0, img.getWidth(), img.getHeight(), this);
} catch (IOException e) {
e.printStackTrace();
}
}
};
friendWindow.setToolTipText("右键单击关闭对话窗口");
friendWindow.setPreferredSize(new Dimension(500,25));
friendWindow.setOpaque(false);
friendWindow.setBounds(15, 30, 500, 25);
friendWindow.setLayout(new FlowLayout());
layerPanel=new JLayeredPane();
layerPanel.setBounds(5, 55, 515, 355);
layerPanel.setLayout(null);
userLabel = new JLabel();
userLabel.setFont(new Font("楷体", 1, 1
没有合适的资源?快使用搜索试试~ 我知道了~
mqq.rar_QQ 文件
共302个文件
gif:234个
class:36个
java:19个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 133 浏览量
2022-09-21
18:52:28
上传
评论
收藏 719KB RAR 举报
温馨提示
简单的类QQ聊天工具,可实现文字聊天,发送文件等功能
资源推荐
资源详情
资源评论
收起资源包目录
mqq.rar_QQ 文件 (302个子文件)
MainUi.class 22KB
Receive.class 12KB
LoginUI.class 7KB
ReceiveFileUi.class 7KB
FrameTool.class 6KB
Server.class 5KB
MyReceive.class 5KB
ServerUi.class 5KB
DialogFriend$MyMouseListener.class 4KB
Send.class 4KB
DialogFriend.class 4KB
Send$1.class 3KB
MyDialog.class 3KB
MessageBean.class 3KB
Playback.class 3KB
Playback.class 3KB
MainUi$MyCellRenderer.class 3KB
ReceiveFileBean.class 2KB
Capture.class 2KB
Capture.class 2KB
SocketBean.class 2KB
TipDialog.class 2KB
MainUi$1.class 2KB
MainUi$2.class 2KB
ServerUi$2.class 1KB
ServerUi$1.class 1KB
LoginUI$1.class 1KB
MyObjectOutputStream.class 1013B
ServerUi$2$1.class 963B
FrameTool$1.class 963B
Server$1.class 927B
MyFileDialog.class 767B
MyDialog$1.class 724B
Login.class 545B
Login$1.class 528B
ServerUi$3.class 513B
.classpath 353B
111.gif 3KB
104.gif 2KB
112.gif 2KB
101.gif 2KB
113.gif 2KB
116.gif 2KB
110.gif 2KB
108.gif 2KB
114.gif 2KB
102.gif 2KB
115.gif 2KB
103.gif 2KB
107.gif 2KB
106.gif 2KB
109.gif 2KB
37.gif 2KB
117.gif 2KB
86.gif 2KB
4.gif 2KB
60.gif 2KB
50.gif 2KB
69.gif 2KB
38.gif 2KB
29.gif 2KB
99.gif 2KB
97.gif 2KB
85.gif 2KB
24.gif 2KB
87.gif 2KB
20.gif 2KB
105.gif 2KB
81.gif 2KB
91.gif 2KB
72.gif 2KB
84.gif 2KB
74.gif 2KB
57.gif 2KB
25.gif 2KB
39.gif 2KB
66.gif 2KB
88.gif 2KB
83.gif 2KB
40.gif 2KB
53.gif 2KB
75.gif 2KB
65.gif 2KB
35.gif 2KB
12.gif 2KB
71.gif 2KB
70.gif 2KB
22.gif 2KB
33.gif 2KB
58.gif 2KB
51.gif 2KB
89.gif 2KB
67.gif 2KB
61.gif 2KB
45.gif 2KB
49.gif 2KB
52.gif 2KB
93.gif 2KB
94.gif 2KB
30.gif 2KB
共 302 条
- 1
- 2
- 3
- 4
资源评论
周楷雯
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- Highlight Plus v20.0.1
- 基于MIC+NE555光敏电阻的声光控电路Multisim仿真原理图
- python tkinter-08-盒子模型.ev4.rar
- Doozy UI Manager 2023
- 基于matlab实现夜间车牌识别程序(1).rar
- 基于matlab实现无线传感器网络无需测距定位算法matlab源代码 包括apit,dv-hop,amorphous在内的共7个
- 基于python的yolov5实现的旋转目标检测
- 基于matlab实现无线传感器网络 CAB定位仿真程序 这是无线传感器节点定位CAB算法的仿真程序,由matlab完成.rar
- 基于matlab实现图像处理,本程序使用背景差分法对来往车辆进行检测和跟踪.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功