本文整理汇总了Java中javax.swing.text.html.HTMLEditorKit.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Java HTMLEditorKit.setStyleSheet方法的具体用法?Java HTMLEditorKit.setStyleSheet怎么用?Java HTMLEditorKit.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.html.HTMLEditorKit
的用法示例。
在下文中一共展示了HTMLEditorKit.setStyleSheet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postInitComponents
import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的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"));
}
示例2: PanelBodyContainer
import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的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 ();
}
示例3: OperatorDocumentationBrowser
import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
/**
* Prepares the dockable and its elements.
*/
public OperatorDocumentationBrowser() {
setLayout(new BorderLayout());
// Instantiate Editor and set Settings
editor.installDefaultStylesheet();
editor.addHyperlinkListener(new OperatorHelpLinkListener());
editor.setEditable(false);
HTMLEditorKit hed = new HTMLEditorKit();
hed.setStyleSheet(createStyleSheet(hed.getStyleSheet()));
editor.setEditorKit(hed);
editor.setBackground(Colors.PANEL_BACKGROUND);
editor.setContentType("text/html");
// add editor to scrollPane
scrollPane = new ExtendedJScrollPane(editor);
scrollPane.setMinimumSize(new Dimension(100, 100));
scrollPane.setPreferredSize(new Dimension(100, 100));
// add scrollPane to Dockable
scrollPane.setBorder(null);
this.add(scrollPane, BorderLayout.CENTER);
this.setVisible(true);
this.validate();
documentationUpdateQueue.start();
}
示例4: DetailsPanel
import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的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 );
}