📄 toppanel.java
字号:
package com.softfz.jn0708.chat.toppanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import com.softfz.jn0708.chat.ChatFrame;
import com.softfz.jn0708.srcpackage.TUser;
import com.softfz.jn0708.util.Tools;
/**
* 聊天窗体的顶部面板
* @author admin
*
*/
public class TopPanel extends JPanel {
private static final long serialVersionUID = 1L;
private JLabel touser = new JLabel();
private JLabel touser1 = new JLabel();
private JLabel usertrem = new JLabel();
private JLabel user = new JLabel();
private JLabel userID = new JLabel();
private JButton set = new JButton(" 密码设置 ");
private SetPwd setpwd ;
/**
* 构造函数
* @param chatframe
*/
public TopPanel(final ChatFrame chatframe) {
super();
Tools.setFont(new Font("宋体",Font.PLAIN,12));
touser.setText("正与 ");
touser1.setText(" 聊天");
usertrem.setText("");
user.setText("用户昵称: ");
userID.setText("");
//user.setFont(new Font("宋体",Font.PLAIN,14));
user.setSize(new Dimension(50,30));
user.setBackground(Color.BLACK);
// userID.setText(chatframe.getUser().getUNO());
userID.setSize(new Dimension(100,30));
userID.setBackground(Color.GREEN);
this.setPreferredSize(new Dimension(495,30));
//jplTop.setMinimumSize(new Dimension(495,30));
this.setMaximumSize(new Dimension(1028,30));
// this.setBackground(new Color(220,231,246));
this.setBackground(new Color(116,191,252));
this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
this.add(Box.createHorizontalStrut(15));
this.add(touser);
this.add(usertrem);
this.add(touser1);
this.add(Box.createHorizontalGlue());
this.add(user);
this.add(userID );
this.add(Box.createHorizontalStrut(20));
this.add(set);
this.add(Box.createHorizontalStrut(15));
set.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
setpwd = new SetPwd(chatframe);
setpwd.show();
}
});
}
/**
* 获取用户Id文本框
* @return
*/
public JLabel getUserID() {
return userID;
}
/**
* 获取用户昵称文本框
* @return
*/
public JLabel getUsertrem() {
return usertrem;
}
public SetPwd getSetpwd() {
return setpwd;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -