本文整理了Java中javax.swing.JTextPane.setEditorKit()
方法的一些代码示例,展示了JTextPane.setEditorKit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setEditorKit()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setEditorKit
暂无
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@NotNull
public static JTextPane createDescriptionPane() {
JTextPane result = new JTextPane();
result.addHyperlinkListener(new BrowserHyperlinkListener());
result.setContentType("text/html");
Font descriptionFont = UIUtil.getLabelFont(UIUtil.FontSize.SMALL);
HTMLEditorKit editorKit = UIUtil.getHTMLEditorKit();
editorKit.getStyleSheet().addRule("body, p {" +
"color:#" + ColorUtil.toHex(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER)) + ";" +
"font-family:" + descriptionFont.getFamily() + ";" +
"font-size:" + descriptionFont.getSize() + "pt;}");
result.setHighlighter(null);
result.setEditorKit(editorKit);
return result;
}
}
代码示例来源:origin: stackoverflow.com
JTextPane text_panel = new JTextPane();
HTMLEditorKit kit = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
text_panel.setEditorKit(kit);
text_panel.setDocument(doc);
kit.insertHTML(doc, doc.getLength(), "<b>hello", 0, 0, HTML.Tag.B);
kit.insertHTML(doc, doc.getLength(), "<font color='red'><u>world</u></font>", 0, 0, null);
代码示例来源:origin: ron190/jsql-injection
this.result.setEditorKit(new HTMLEditorKitTextPaneWrap());
代码示例来源:origin: stackoverflow.com
getContentPane().setLayout(new BorderLayout());
JTextPane jtp = new JTextPane();
jtp.setEditorKit(new WrapEditorKit());
JScrollPane jsp = new JScrollPane(jtp);
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
代码示例来源:origin: ron190/jsql-injection
I18nView.addComponentForKey("NETWORK_TAB_RESPONSE_LABEL", labelConsoleq);
PanelConsoles.NETWORK_TAB_PREVIEW.setEditorKit(new HTMLEditorKitTextPaneWrap());
代码示例来源:origin: stackoverflow.com
EditorKit editorKit = new SomeBetterEditorKit();
JTextPane textPane = new JTextPane();
textPane.setEditorKit( editorKit );
代码示例来源:origin: stackoverflow.com
JTextPane pane = new JTextPane();
pane.setEditorKit(new HTMLEditorKit());
代码示例来源:origin: stackoverflow.com
final HTMLEditorKit htmlKit = new HTMLEditorKit();
final JTextPane textPane = new JTextPane( );
textPane.setEditorKit(htmlKit);
textPane.setEditable(true);
JScrollPane scrollPane = new JScrollPane( textPane );
Document doc = textPane.getDocument();
System.out.println(doc.getClass().getName()); // It's an HTML Document
代码示例来源:origin: omegat-org/omegat
/**
* Create a new PatternHighlightRenderer.
* <p>
* Disable line wrap when using this as a single-line renderer. This is because this renderer uses a
* {@link JTextPane} as its rendering component, and the default JTextPane wrapping results in words simply
* disappearing when used as a single-line renderer.
*
* @param lineWrapEnabled
* Whether to allow line wrapping
* @see <a href="https://sourceforge.net/p/omegat/bugs/862/">Bug #862</a>
*/
public PatternHighlightRenderer(boolean lineWrapEnabled) {
component = new JTextPane();
if (!lineWrapEnabled) {
component.setEditorKit(new NoWrapEditorKit());
}
}
代码示例来源:origin: stackoverflow.com
EditorKit editorKit = new StyledEditorKit()
{
public Document createDefaultDocument()
{
return new ColoredDocument();
}
};
JTextPane textPane = new JTextPane();
textPane.setEditorKit( editorKit );
FileReader fr = new FileReader( ... );
BufferedReader br = new BufferedReader( fr );
textPane.read( br, null );
代码示例来源:origin: org.jspresso.framework/jspresso-swing-application
/**
* Creates a text pane.
*
* @param viewDescriptor
* the component view descriptor.
* @return the created text pane.
*/
protected JTextPane createJTextPane(IPropertyViewDescriptor viewDescriptor) {
JTextPane textPane = new JTextPane();
textPane.setEditorKit(new HTMLEditorKit());
textPane.setDragEnabled(true);
return textPane;
}
代码示例来源:origin: stackoverflow.com
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.html.HTMLEditorKit;
public class StyleTestApp {
public static void main(final String[] args) {
final JFrame f = new JFrame("test");
//f.getContentPane().add(new JTextArea("<html>HELLO <font size=\"3\" face=\"verdana\" color=\"red\">WORLD</font></html>"));
final JTextPane p = new JTextPane();
// the HTMLEditorKit is not enabled by default in the JTextPane class.
p.setEditorKit(new HTMLEditorKit());
p.setText("<html>HELLO <font size=\"3\" face=\"verdana\" color=\"red\">WORLD</font></html>");
f.getContentPane().add(p);
f.pack();
f.setVisible(true);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-cldcplatform
private void postInitComponents() {
final HTMLEditorKit htmlkit = new HTMLEditorKit();
final StyleSheet css = htmlkit.getStyleSheet();
if (css.getStyleSheets() == null) {
final StyleSheet css2 = new StyleSheet();
final Font f = new JLabel().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")); // NOI18N
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
private void enableHTML() {
messageField.setContentType("text/html");
messageField.setOpaque(false);
messageField.setEditable(false);
messageField.setEditorKit(new VHTMLEditorKit());
}
代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing
private JTextPane getTextPane() {
if (jTextPane == null) {
jTextPane = new JTextPane();
StyledEditorKit kit = new StyledEditorKit();
jTextPane.setEditorKit(kit);
jTextPane.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
jTextPane.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 12));
jTextPane.setText(_archetypeElementVO.getDescription());
jTextPane.setEditable(false);
jTextPane.setBackground(null);
jTextPane.setPreferredSize(new java.awt.Dimension(250, 70));
}
return jTextPane;
}
代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing
private JTextPane getTextPane() {
if (jTextPane == null) {
jTextPane = new JTextPane();
StyledEditorKit kit = new StyledEditorKit();
jTextPane.setEditorKit(kit);
jTextPane.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
jTextPane.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 12));
jTextPane.setText(OpenEHRLanguageManager.getMessage("NullValueDesc"));
jTextPane.setEditable(false);
jTextPane.setBackground(null);
jTextPane.setPreferredSize(new java.awt.Dimension(250, 70));
}
return jTextPane;
}
代码示例来源:origin: dboissier/jenkins-control-plugin
private void initDebugTextPane() {
HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
HTMLDocument htmlDocument = new HTMLDocument();
debugTextPane.setEditable(false);
debugTextPane.setBackground(Color.WHITE);
debugTextPane.setEditorKit(htmlEditorKit);
htmlEditorKit.install(debugTextPane);
debugTextPane.setDocument(htmlDocument);
}
代码示例来源:origin: stackoverflow.com
JTextPane textPane = new JTextPane();
JButton button = new JButton("Button");
button.setAlignmentY(0.85f);
HTMLEditorKit kit = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
textPane.setEditorKit(kit);
textPane.setDocument(doc);
try {
kit.insertHTML(doc, doc.getLength(), "<p color='#FF0000'>Cool!", 0, 0, HTML.Tag.P);
kit.insertHTML(doc, doc.getLength(), "<p></p>", 0, 0, null);
} catch (BadLocationException ex) {
} catch (IOException ex) {
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
private void disableHTML() {
messageField.setContentType("text/plain");
final Color color = getStyle().
getBaseValues().getColor(TEXT_COLOR_KEY);
messageField.setForeground(color);
messageField.setOpaque(false);
messageField.setEditable(false);
messageField.setEditorKit(new StyledEditorKit());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
/** Creates new form SelectModePanel */
public SelectModePanel(SelectModeDescriptorPanel controller) {
this.controller = controller;
initComponents();
instructions.setEditorKit(new HTMLEditorKit());
instructions.setBackground(instructionPanel.getBackground());
disableHostSensitiveComponents();
refreshRunnable = new RefreshRunnable();
refreshSourceFolderTask = RP2.create(refreshRunnable);
addListeners();
}
内容来源于网络,如有侵权,请联系作者删除!