📄 btnpanel.java
字号:
package com.softfz.jn0708.chat.sendpanel;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.Border;
import com.softfz.jn0708.chat.chatcontent.ChatContent;
/**
* 聊天记录 关闭 发送 按钮面板
* @author admin
*
*/
public class BtnPanel extends JPanel {
private ChatContent chatcontent = null;
private SendPanel sendpanel = null;
/**
* 聊天按钮面板构造函数
* @param chatcontent 聊天内容面板
* @param sendpanel 聊天发送面板
*/
public BtnPanel(final ChatContent chatcontent,final SendPanel sendpanel){
this.chatcontent = chatcontent;
this.sendpanel = sendpanel;
MyActionLisenter myactionlisenter = new MyActionLisenter(chatcontent,sendpanel);
//边框
Border line = BorderFactory.createLineBorder(new Color(144,185,213));
// Border empty = BorderFactory.createEmptyBorder(5,5,5,5);
// Border border = BorderFactory.createCompoundBorder(line,empty);
// border = BorderFactory.createCompoundBorder(border,line);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.setPreferredSize(new Dimension(347,34));
//this.setMinimumSize(new Dimension(347,33));
this.setMaximumSize(new Dimension(880,34));
this.setBackground(new Color(204,223,246));
this.setBorder(line);
JButton btnRecord = new JButton("聊天记录");
JButton btnClose = new JButton("关闭");
JButton btnSend = new JButton("发送");
//btnRecord.setMinimumSize(new Dimension(91,25));
btnRecord.setMaximumSize(new Dimension(91,25));
btnRecord.setPreferredSize(new Dimension(91,25));
//btnClose.setMinimumSize(new Dimension(60,25));
btnClose.setMaximumSize(new Dimension(60,25));
btnClose.setPreferredSize(new Dimension(60,25));
//btnSend.setMinimumSize(new Dimension(60,25));
btnSend.setMaximumSize(new Dimension(60,25));
btnSend.setPreferredSize(new Dimension(60,25));
this.add(Box.createHorizontalStrut(10));
this.add(btnRecord);
btnRecord.setActionCommand("RECORD");
btnRecord.addActionListener(myactionlisenter);
this.add(Box.createHorizontalGlue());
this.add(btnClose);
btnClose.setActionCommand("CLOSE");
btnClose.addActionListener(myactionlisenter);
this.add(Box.createHorizontalStrut(8));
this.add(btnSend);
btnSend.setActionCommand("SEND");
btnSend.addActionListener(myactionlisenter);
this.add(Box.createHorizontalStrut(13));
}
/**
* 获取聊天内容面板
* @return
*/
public ChatContent getChatcontent() {
return chatcontent;
}
// /**
// *
// * @param chatcontent
// */
// public void setChatcontent(ChatContent chatcontent) {
// this.chatcontent = chatcontent;
// }
/**
* 获取发送 按钮面板
*/
public SendPanel getSendpanel() {
return sendpanel;
}
// public void setSendpanel(SendPanel sendpanel) {
// this.sendpanel = sendpanel;
// }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -