當前位置: 首頁>>代碼示例>>Java>>正文


Java StyleSheet.getStyleSheets方法代碼示例

本文整理匯總了Java中javax.swing.text.html.StyleSheet.getStyleSheets方法的典型用法代碼示例。如果您正苦於以下問題:Java StyleSheet.getStyleSheets方法的具體用法?Java StyleSheet.getStyleSheets怎麽用?Java StyleSheet.getStyleSheets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.text.html.StyleSheet的用法示例。


在下文中一共展示了StyleSheet.getStyleSheets方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: postInitComponents

import javax.swing.text.html.StyleSheet; //導入方法依賴的package包/類
private void postInitComponents () {
    this.jLabel2.setVisible(false);
    this.platformHome.setVisible(false);
    final Collection installFolders = platform.getInstallFolderURLs();
    if (platform.getInstallFolders().isEmpty() && installFolders.size() > 0) {
        this.jLabel2.setVisible(true);
        this.platformHome.setVisible(true);
        this.platformHome.setForeground(new Color (164,0,0));
        this.platformHome.setText (Utilities.toFile(URI.create(((URL)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
    }
    HTMLEditorKit htmlkit = new HTMLEditorKit();                
    StyleSheet css = htmlkit.getStyleSheet();
    if (css.getStyleSheets() == null) {
        StyleSheet css2 = new StyleSheet();
        Font f = jLabel2.getFont();
        css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
            .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
        css2.addStyleSheet(css);
        htmlkit.setStyleSheet(css2);
    }
    jTextPane1.setEditorKit(htmlkit);        
    jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:BrokenPlatformCustomizer.java

示例2: PanelBodyContainer

import javax.swing.text.html.StyleSheet; //導入方法依賴的package包/類
/** Creates new form InstallPanelContainer */
public PanelBodyContainer (String heading, String msg, JPanel bodyPanel) {
    head = heading;
    message = msg;
    this.bodyPanel = bodyPanel;
    initComponents ();
    
    HTMLEditorKit htmlkit = new HTMLEditorKitEx();
    // override the Swing default CSS to make the HTMLEditorKit use the
    // same font as the rest of the UI.

    // XXX the style sheet is shared by all HTMLEditorKits.  We must
    // detect if it has been tweaked by ourselves or someone else
    // (code completion javadoc popup for example) and avoid doing the
    // same thing again

    StyleSheet css = htmlkit.getStyleSheet();

    if (css.getStyleSheets() == null) {
        StyleSheet css2 = new StyleSheet();
        Font f = new JList().getFont();
        int size = f.getSize();
        css2.addRule(new StringBuffer("body { font-size: ").append(size) // NOI18N
                .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
        css2.addStyleSheet(css);
        htmlkit.setStyleSheet(css2);
    }
    
    tpPanelHeader.setEditorKit(htmlkit);
    tpPanelHeader.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
    writeToHeader (head, message);
    initBodyPanel ();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:PanelBodyContainer.java

示例3: DetailsPanel

import javax.swing.text.html.StyleSheet; //導入方法依賴的package包/類
public DetailsPanel() {
    initComponents2();
    HTMLEditorKit htmlkit = new HTMLEditorKitEx();
    // override the Swing default CSS to make the HTMLEditorKit use the
    // same font as the rest of the UI.
    
    // XXX the style sheet is shared by all HTMLEditorKits.  We must
    // detect if it has been tweaked by ourselves or someone else
    // (code completion javadoc popup for example) and avoid doing the
    // same thing again
    
    StyleSheet css = htmlkit.getStyleSheet();
    
    if (css.getStyleSheets() == null) {
        StyleSheet css2 = new StyleSheet();
        Font f = new JList().getFont();
        int size = f.getSize();
        css2.addRule(new StringBuffer("body { font-size: ").append(size) // NOI18N
                .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
        css2.addStyleSheet(css);
        htmlkit.setStyleSheet(css2);
    }
    
    setEditorKit(htmlkit);
    addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent hlevt) {
            if (EventType.ACTIVATED == hlevt.getEventType()) {
                if (hlevt.getURL () != null) {
                    Utilities.showURL(hlevt.getURL());
                }
            }
        }
    });
    setEditable(false);
    setPreferredSize(new Dimension(300, 80));
    RP.post(new Runnable() {

        @Override
        public void run() {
            getAccessibleContext ().setAccessibleName (
                    NbBundle.getMessage (DetailsPanel.class, "ACN_DetailsPanel")); // NOI18N
        }
    });

    putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:48,代碼來源:DetailsPanel.java


注:本文中的javax.swing.text.html.StyleSheet.getStyleSheets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。