package frame;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.File;
import java.util.ArrayList;
import javax.swing.Action;
import javax.swing.Box;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.JToolBar;
import javax.swing.ListSelectionModel;
import javax.swing.text.StyledEditorKit;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import mailutil.SendAttachMail;
import utils.EditorPopupMenu;
import utils.EditorUtils;
import utils.SendedMailTable;
/**
* 发送邮件界面
*/
public class SendFrame extends JInternalFrame implements ActionListener,
MouseListener, MouseMotionListener, FocusListener {
private JComboBox fontSizeCB;// 字体大小列表
private JComboBox fontCB;// 字体列表
private JTextPane sendCotent;// 发送内容面板
private JTextField subjectTF;// 邮件主题文本框
private JTextField copy_to;// 抄送
private JTextField to_mail;// 收件人
private JList attachmentList = null;// 附件列表,最多能添加三个附件
private JScrollPane scrollPane = null;// 正文编辑窗口
private JScrollPane jsp = null;// 用于显示附件
private DefaultListModel listmodel = null;// 附件列表模型
private JLabel adjunctL = null;// 附件标签
private JLabel to_mailLabel = null, copy_toLabel = null,
subject_Label = null;
private JButton sendButton = null;// 发送按钮
private JButton resetButton = null;// 重置
private JButton attachmentButton = null;// 插入附件按钮
private JButton selectColorButton = null;// 颜色选择按钮
private Box baseBox = null, boxV1 = null, boxV2 = null;
private ArrayList<String> attachArrayList = new ArrayList<String>();// 用于存储附件路径的链表
private Color color = Color.black;
// 属性定义
private Action boldAction = new StyledEditorKit.BoldAction();// 添加加粗侦听器
private Action underlineAction = new StyledEditorKit.UnderlineAction(); // 添加加下划线侦听器
private Action italicAction = new StyledEditorKit.ItalicAction(); // 添加倾斜侦听器
private HTMLDocument document = null;// 声明一个网页文档对象变量
private SendAttachMail sendMail = null;
private EditorPopupMenu rightMouseButton = null;
private JProgressBarFrame progressBar = null;// 进度条实例
public SendFrame() {
super("新邮件");
this.setFrameIcon(EditorUtils.createIcon("newMail.gif"));
// 初始化基本项
getContentPane().setLayout(new BorderLayout());// 设置空布局
setIconifiable(true);// 是否使 JInternalFrame 变成一个图标
setClosable(true);// 是否关闭
setMaximizable(true);// 窗口最大化设置
setResizable(true);// 设置窗口课以调整大小
setBounds(10, 10, 640, 600);// 设置界面的大小
setVisible(true);
// 设置收件人标签
to_mailLabel = new JLabel();
to_mailLabel.setText("收件人:");
// 抄送标签
copy_toLabel = new JLabel();
copy_toLabel.setText("抄送:");
// 主题标签
subject_Label = new JLabel();
subject_Label.setText("主题:");
// 收件人文本框
to_mail = new JTextField(80);
to_mail.addFocusListener(this);
to_mail.setToolTipText("将收件人地址以逗号分隔");
// 抄送文本框
copy_to = new JTextField(80);
copy_to.addFocusListener(this);
// 主题文本框
subjectTF = new JTextField(80);
JPanel setPanel = new JPanel();// 上半部
setPanel.add(box());
scrollPane = new JScrollPane();
sendCotent = new JTextPane();
sendCotent.setContentType("text/html");
HTMLEditorKit editorKit = new HTMLEditorKit();
document = (HTMLDocument) editorKit.createDefaultDocument();// 创建默认文档指向网页引用document
sendCotent.setEditorKit(editorKit);// 设置为html格式的编辑器
sendCotent.setDocument(document);
sendCotent.addMouseListener(this);
scrollPane.setViewportView(sendCotent);
// 工具条
final JToolBar toolBar = new JToolBar();
getContentPane().add(toolBar);
sendButton = new JButton("发送", EditorUtils.createIcon("newsend.gif"));
sendButton.addActionListener(this);
toolBar.add(sendButton);
resetButton = new JButton("重写", EditorUtils.createIcon("rewrite.gif"));
resetButton.addActionListener(this);
toolBar.add(resetButton);
// 附件列表
listmodel = new DefaultListModel();
adjunctL = new JLabel("附件:");
jsp = new JScrollPane();// 用于显示JList
jsp.setPreferredSize(new Dimension(350, 20));
attachmentList = new JList(listmodel);
attachmentList.addMouseListener(this);// 为邮件列表添加鼠标事件
jsp.setViewportView(attachmentList);// 设置JScrollPanel的视图为JList
attachmentList
.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
attachmentList.setVisibleRowCount(1);
attachmentList.setLayoutOrientation(JList.VERTICAL_WRAP);
// 插入附件按钮
attachmentButton = new JButton("插入附件",
EditorUtils.createIcon("attach.png"));
attachmentButton.addActionListener(this);
toolBar.add(attachmentButton);
// 斜体按钮
JButton italicButton = new JButton(italicAction);
italicButton.setIcon(EditorUtils.createIcon("italic.gif"));
italicButton.setText("");
italicButton.setPreferredSize(new Dimension(22, 22));
// 粗体按钮
JButton blodButton = new JButton(boldAction);
blodButton.setIcon(EditorUtils.createIcon("blod.gif"));
blodButton.setText("");
blodButton.setPreferredSize(new Dimension(22, 22));
// 下划线按钮
JButton underlineButton = new JButton(underlineAction);
underlineButton.setIcon(EditorUtils.createIcon("underline.gif"));
underlineButton.setText("");
underlineButton.setPreferredSize(new Dimension(22, 22));
// 字体
final JLabel fontLabel = new JLabel("字体");
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();// 获得本地 计算机上字体可用的名称
String font[] = ge.getAvailableFontFamilyNames();
fontCB = new JComboBox(font);
fontCB.addActionListener(this);
// 字号列表
final JLabel fontSizeLabel = new JLabel("字号");
String fontSize[] = { "10", "11", "12", "13", "14", "16", "18", "20",
"22", "24", "26", "28", "36", "48" };
fontSizeCB = new JComboBox(fontSize);
fontSizeCB.addActionListener(this);
fontSizeCB.setPreferredSize(new Dimension(50, 23));
// 颜色
final JLabel colorLabel = new JLabel("颜色");
selectColorButton = new JButton("选 色");
selectColorButton.addActionListener(this);
JPanel editorToolBarPanel = new JPanel();// 编辑区工具条
editorToolBarPanel.add(italicButton);
editorToolBarPanel.add(blodButton);
editorToolBarPanel.add(underlineButton);
editorToolBarPanel.add(new JLabel(" "));
editorToolBarPanel.add(fontLabel);
editorToolBarPanel.add(fontCB);
editorToolBarPanel.add(new JLabel(" "));
editorToolBarPanel.add(fontSizeLabel);
editorToolBarPanel.add(fontSizeCB);
editorToolBarPanel.add(new JLabel(" "));
editorToolBarPanel.add(colorLabel);
editorToolBarPanel.add(selectColorButton);
// 编辑区面板
JPanel editorPanel = new JPanel(new BorderLayout());// 编辑区
editorPanel.add(editorToolBarPanel, BorderLayout.NORTH);
editorPanel.add(scrollPane, BorderLayout.CENTER);
// 添加一个分割窗口
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
setPanel, editorPanel);
splitPane.setOneTouchExpa
没有合适的资源?快使用搜索试试~ 我知道了~
javamail(带界面的javamail)
共149个文件
class:51个
java:32个
png:30个
4星 · 超过85%的资源 需积分: 9 23 下载量 189 浏览量
2012-12-20
08:37:33
上传
评论 1
收藏 1.31MB ZIP 举报
温馨提示
javamail开发,带图形界面,邮件的发送,接收,带附件,html,邮件解析
资源推荐
资源详情
资源评论
收起资源包目录
javamail(带界面的javamail) (149个子文件)
SendFrame.class 15KB
GetMail.class 9KB
MainFrame.class 9KB
SendAttachMail.class 8KB
BaseReceiceFrame.class 7KB
LoginFrame.class 7KB
ReceiveMailTable.class 6KB
AddLinkManFrame.class 6KB
SystemBickerTray.class 5KB
SendedMailTable.class 5KB
ReadLinkmanXMl.class 4KB
EditorPopupMenu.class 4KB
AttachFile.class 4KB
SaveLinkmans2XML.class 3KB
CheckNewMialUtil.class 3KB
LinkmanEventAction.class 3KB
RecycleMailTable.class 2KB
SendedFrame.class 2KB
RecycleFrame.class 2KB
ReceiveFrame.class 2KB
ClassNameTreeCellRenderer.class 2KB
LoginAction.class 2KB
SendFrame$2.class 2KB
EditorUtils.class 2KB
JProgressBarFrame.class 2KB
EditorPopupMenu$UndoAction.class 2KB
EditorPopupMenu$RedoAction.class 2KB
MainFrame$1.class 2KB
BaseReceiceFrame$1.class 1KB
EditorPopupMenu$1.class 1KB
LinkmanListTabelModel.class 1KB
MailTableModel.class 1KB
SendFrame$1.class 1KB
CellRender.class 1KB
EditorPopupMenu$UndoHandler.class 1KB
CheckNewMail.class 1KB
AttachFile$1.class 1KB
FrameFactory.class 1KB
MyAudioPlayer.class 1KB
ReceiveMailTable$1.class 930B
SystemBickerTray$2.class 840B
SystemBickerTray$3.class 840B
MainMethod.class 835B
ReceiveMailTable$3.class 829B
SystemBickerTray$4.class 792B
SystemBickerTray$1.class 785B
BaseReceiceFrame$2.class 775B
SmtpPop3Auth.class 701B
LoginFrame$1.class 617B
ReceiveMailTable$2.class 591B
MainMethod$1.class 551B
.classpath 391B
main.gif 121KB
main.gif 121KB
rewrite.gif 2KB
rewrite.gif 2KB
linkman.gif 1KB
linkman.gif 1KB
newsend.gif 1KB
newsend.gif 1KB
exit.gif 644B
exit.gif 644B
newMail.gif 592B
newMail.gif 592B
home.gif 576B
home.gif 576B
underline.gif 130B
underline.gif 130B
blod.gif 127B
blod.gif 127B
italic.gif 124B
italic.gif 124B
mail.jar 451KB
dom4j-2.0.0-ALPHA-2.jar 332KB
SendFrame.java 15KB
MainFrame.java 9KB
GetMail.java 8KB
BaseReceiceFrame.java 7KB
SendAttachMail.java 7KB
LoginFrame.java 6KB
AddLinkManFrame.java 5KB
ReceiveMailTable.java 5KB
EditorPopupMenu.java 5KB
SendedMailTable.java 4KB
SystemBickerTray.java 4KB
SaveLinkmans2XML.java 3KB
ReadLinkmanXMl.java 3KB
LinkmanEventAction.java 3KB
AttachFile.java 2KB
CheckNewMialUtil.java 2KB
LoginAction.java 2KB
JProgressBarFrame.java 2KB
RecycleMailTable.java 2KB
SendedFrame.java 2KB
ClassNameTreeCellRenderer.java 2KB
RecycleFrame.java 2KB
ReceiveFrame.java 1KB
LinkmanListTabelModel.java 1KB
CheckNewMail.java 1KB
FrameFactory.java 963B
共 149 条
- 1
- 2
资源评论
- ??|??2013-07-01界面 还行 内部代码有问题
- jaorjixiaocong2013-12-13代码有那么一点问题。。
walt18
- 粉丝: 4
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功