📄 onlinepanel.java
字号:
package chat.client;
import java.awt.*;
import javax.swing.*;
public class OnlinePanel extends JPanel{
static int width = 200;
static int height = 300;
JComboBox users;
JButton qunLiao;
JButton siLiao;
public OnlinePanel(){
this.setSize(width, height);
users = new JComboBox();
qunLiao = new JButton("群聊");
siLiao = new JButton("私聊");
this.setLayout(null);
JLabel l1 = new JLabel("欢迎进入聊天室");
JLabel l2 = new JLabel("在线用户");
JLabel l3 = new JLabel("选择用户单独聊天请点击'私聊'");
this.add(l1);
this.add(l3);
this.add(l2);
this.add(users);
this.add(siLiao);
this.add(qunLiao);
qunLiao.setSize(80, 30);
siLiao.setSize(60, 30);
l1.setSize(140, 30);
l3.setSize(180, 30);
l2.setSize(65, 30);
users.setSize(70, 30);
l1.setLocation(30, 20);
l3.setLocation(10, 70);
l2.setLocation(0, 110);
users.setLocation(60, 110);
siLiao.setLocation(135, 110);
qunLiao.setLocation(60, 170);
}
public int getWidth(){
return width;
}
public int getHeight(){
return height;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -