当前位置: 首页>>代码示例>>Java>>正文


Java HTMLDocument.setBase方法代码示例

本文整理汇总了Java中javax.swing.text.html.HTMLDocument.setBase方法的典型用法代码示例。如果您正苦于以下问题:Java HTMLDocument.setBase方法的具体用法?Java HTMLDocument.setBase怎么用?Java HTMLDocument.setBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.html.HTMLDocument的用法示例。


在下文中一共展示了HTMLDocument.setBase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initComponents

import javax.swing.text.html.HTMLDocument; //导入方法依赖的package包/类
private void initComponents(URL ruleBase, String htmlDescription) {
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    HTMLTextArea descriptionArea = new HTMLTextArea();
    HTMLDocument hdoc = (HTMLDocument) descriptionArea.getDocument();
    descriptionArea.setText(htmlDescription);
    descriptionArea.setCaretPosition(0);
    hdoc.setBase(ruleBase);

    JScrollPane descriptionAreaScrollPane = new JScrollPane(descriptionArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    descriptionAreaScrollPane.setPreferredSize(new Dimension(375, 220));

    add(descriptionAreaScrollPane, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AnalysisControllerUI.java

示例2: openPSP

import javax.swing.text.html.HTMLDocument; //导入方法依赖的package包/类
public javax.swing.text.Document openPSP(PSP psp) {

        HTMLDocument doc = (HTMLDocument) editorKit.createDefaultDocument();
        if (psp == null)
            return doc;
        String filename = getPSPPath(psp);
        try {
            /*DEBUG*/

//            Util.debug("Open note: " + filename);
//        	Util.debug("Note Title: " + note.getTitle());
        	doc.setBase(new URL(getPSPURL(psp)));
        	editorKit.read(
                new InputStreamReader(new FileInputStream(filename), "UTF-8"),
                doc,
                0);
        }
        catch (Exception ex) {
            //ex.printStackTrace();
            // Do nothing - we've got a new empty document!
        }
        
        return doc;
    }
 
开发者ID:ser316asu,项目名称:Dahlem_SER316,代码行数:25,代码来源:FileStorage.java

示例3: openNote

import javax.swing.text.html.HTMLDocument; //导入方法依赖的package包/类
/**
     * @see net.sf.memoranda.util.Storage#openNote(net.sf.memoranda.Note)
     */
    public javax.swing.text.Document openNote(Note note) {

        HTMLDocument doc = (HTMLDocument) editorKit.createDefaultDocument();
        if (note == null)
            return doc;
        /*
                String filename = JN_DOCPATH + note.getProject().getID() + File.separator;
                CalendarDate d = note.getDate();
                filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
        */
        String filename = getNotePath(note);
        try {
            /*DEBUG*/

//            Util.debug("Open note: " + filename);
//        	Util.debug("Note Title: " + note.getTitle());
        	doc.setBase(new URL(getNoteURL(note)));
        	editorKit.read(
                new InputStreamReader(new FileInputStream(filename), "UTF-8"),
                doc,
                0);
        }
        catch (Exception ex) {
            //ex.printStackTrace();
            // Do nothing - we've got a new empty document!
        }
        
        return doc;
        /*HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
        if (note == null) return doc;
        String filename = JN_DOCPATH + note.getProject().getID() + "/";
        CalendarDate d = note.getDate();
        filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
        try {
            long t1 = new java.util.Date().getTime();
            FileInputStream istream = new FileInputStream(filename);
            ObjectInputStream ois = new ObjectInputStream(istream);
            doc = (HTMLDocument)ois.readObject();
            ois.close();
            istream.close();
            long t2 = new java.util.Date().getTime();
            System.out.println(filename+" open:"+ (t2-t1) );
        }
        catch (Exception ex) {
            ex.printStackTrace();
        }
        return doc;*/
    }
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:52,代码来源:FileStorage.java

示例4: openNote

import javax.swing.text.html.HTMLDocument; //导入方法依赖的package包/类
/**
 * @see net.sf.memoranda.util.Storage#openNote(net.sf.memoranda.Note)
 */
public javax.swing.text.Document openNote(Note note) {

    HTMLDocument doc = (HTMLDocument) editorKit.createDefaultDocument();
    if (note == null)
        return doc;
    /*
            String filename = JN_DOCPATH + note.getProject().getID() + File.separator;
            CalendarDate d = note.getDate();
            filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
    */
    String filename = getNotePath(note);
    try {
        /*DEBUG*/

    	doc.setBase(new URL(getNoteURL(note)));
    	editorKit.read(
            new InputStreamReader(new FileInputStream(filename), "UTF-8"),
            doc,
            0);
    }
    catch (Exception ex) {
        //ex.printStackTrace();
        // Do nothing - we've got a new empty document!
    }
    
    return doc;
    /*HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
    if (note == null) return doc;
    String filename = JN_DOCPATH + note.getProject().getID() + "/";
    CalendarDate d = note.getDate();
    filename += d.getDay() + "-" + d.getMonth() + "-" + d.getYear();
    try {
        long t1 = new java.util.Date().getTime();
        FileInputStream istream = new FileInputStream(filename);
        ObjectInputStream ois = new ObjectInputStream(istream);
        doc = (HTMLDocument)ois.readObject();
        ois.close();
        istream.close();
        long t2 = new java.util.Date().getTime();
        Util.debug(filename+" open:"+ (t2-t1) );
    }
    catch (Exception ex) {
        ex.printStackTrace();
    }
    return doc;*/
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:50,代码来源:FileStorage.java


注:本文中的javax.swing.text.html.HTMLDocument.setBase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。