Java聊天室 IO流 Socket流 GUI界面 客户端TiShi界面详解
效果图
代码
package SanWa.UI;
import SanWa.Util.PathUtils;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.util.Objects;
public class TiShi extends Box {
public static JTextArea infortextArea1;
public static JTextArea infortextArea2;
public static ObjectOutputStream send = MainView.out;
private JPanel c2;
private JPanel c22;
public TiShi() {
//垂直布局
super(BoxLayout.Y_AXIS);
//this.setBackground(new Color(208,208,208));
BackGroundPanel bgPanel = null;
try {
bgPanel = new BackGroundPanel(ImageIO.read(new File(PathUtils.getRealPath("x001.png"))));
} catch (IOException e) {
e.printStackTrace();
}
Box u5Box = Box.createHorizontalBox();
u5Box.setPreferredSize(new Dimension(5000,600));
JScrollPane scrollPane_5 = new JScrollPane();
scrollPane_5.setPreferredSize(new Dimension(5000,600));
scrollPane_5.setViewportView(bgPanel);
u5Box.add(scrollPane_5);
this.add(u5Box);
}
}