java实现模拟 邮件 发送页面
效果图
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
public class EmailFrame extends JFrame {
EmailFrame email;//EmailFrame 这个窗体命名为email
//-------------------最上面的头页面-------------------
JPanel HeadJPanel=new JPanel();
JButton sendButton=new JButton(new ImageIcon("src/send.png"));
JButton saveButton=new JButton(new ImageIcon("src/save.png"));
JButton switchButton=new JButton(new ImageIcon("src/switch.png"));
//-------------------最上面的头页面-------------------
//-------------------主要的发送页面-------------------
JPanel mainPanel=new JPanel();//主面板
JLabel from =new JLabel(new ImageIcon("src/from.png"));//发件人标签
JLabel to=new JLabel(new ImageIcon("src/to.png"));//收件人标签
JLabel titleLabel=new JLabel("主 题:");//主题
JLabel contentLabel=new JLabel("内 容:");//内容
static JLabel senderLabel= new JLabel("46290203@qq.com");
JTextField addresseeTextField=new JTextField("1007010426@qq.com;zhangsan@163.com;");
JTextField titleTextField=new JTextField("好好学习");
JComboBox fontComboBox=new JComboBox(new String []{
"微软雅黑","黑体","宋体"});
JTextArea textArea=new JTextArea("发送内容信息");//创建文本域这里放发送内容信息
JScrollPane textAreaJsp=new JScrollPane(textArea);//创建滚动面板 把发送内容信息文本域放到滚动面板里面
JButton btnApply =new JButton("应用");
JCheckBox ordinaryEmailCheck=new JCheckBox("普通邮件");
JCheckBox urgentEmailCheck=new JCheckBox("紧急邮件");
JCheckBox receiptCheck=new JCheckBox("阅读回执");
JRadioButton normalRadio=new JRadioButton("普通发送");
JRadioButton encryptRadio=new JRadioButton("加密发送");
ButtonGroup RadioGroup =new ButtonGroup();//按钮组
//-------------------主要的发送页面-------------------
//-------------------联系人页面-------------------
JPanel TitlePanel = new JPanel();//联系人标题
JLabel contactsLabel=new JLabel(" 联系人");
JPanel contactsPanel = new JPanel();//联系人列表框和按钮面板
JList<String> emailList=new JList<String>(new String [] {
"1007010426@qq.com", "zhangsan@163.com","lisi@mingrisoft.com",
"123123213@qq.com", "erbailalla@126.com", "admin@qq.com", "password@qq.com", "xiaoqiang@163.com" });
JScrollPane emailListJSP=new JScrollPane(emailList);
JButton submitAddressBtn =new JButton("确认");
//-------------------联系人页面-------------------
public EmailFrame(){
setVisible(true);//窗体可视为真
setTitle("Send Email");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(950, 615);//设置窗体大小
setLocationRelativeTo(null);//把窗体放在屏幕中间
Container c=getContentPane();
c.setLayout(null);
setResizable(false); // 设置窗体不可改变大小
//JFrame基本设置
//-------------------最上面的头页面属性设置-------------------
HeadJPanel.setLayout(null);//布局设置为随机布局
HeadJPanel.setBackground(SystemColor.inactiveCaption);//背景颜色
sendButton.setBounds(10,6,56,56); //按钮send 的坐标和大小
saveButton.setBounds(76,6,56,56); //按钮save 的坐标和大小
switchButton.setB