⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showhtmldialog.java

📁 基于JavaMail API 实现的桌面程序,邮件收发器
💻 JAVA
字号:
/*
 * showHtmlDialog.java
 *
 * Created on 2006年5月25日, 下午1:35
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package javamail;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
/**
 *
 * @author freezing
 */
public class showHtmlDialog extends JDialog{
    
    /** Creates a new instance of showHtmlDialog */
    private String body;
    private javax.swing.JEditorPane ep;
    private javax.swing.JScrollPane scroll;
    public showHtmlDialog(String str)throws IOException
    {
        body=str;
        ep=new JEditorPane();
        ep.setEditable(false);
        
        ep.addHyperlinkListener(new HyperlinkListener()
                {
            public void hyperlinkUpdate(HyperlinkEvent e)
            {
                try{
                ep_hyperlinkUpdate(e);
                }catch(IOException ev)
                {
                    System.out.println(e);
                }
                }
            }
                );//end jEditorPane1HyperlinkListener

        scroll=new JScrollPane();
        ep.setContentType("text/html");
        ep.setText(body);
        scroll.getViewport().add(ep);
        this.add(scroll);
        this.setTitle("信件内容如下:");
        this.setSize(400,400);
        this.setLocation(100,100);
    }
    public void ep_hyperlinkUpdate(HyperlinkEvent e)throws IOException
    {
        if(e.getSource()==ep&&e.getEventType()==HyperlinkEvent.EventType.ACTIVATED)
       {
           ep.setPage(e.getURL());
           }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -