本文整理了Java中javax.swing.JTextPane.setContentType()
方法的一些代码示例,展示了JTextPane.setContentType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setContentType()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setContentType
暂无
代码示例来源:origin: stackoverflow.com
JTextPane f = new JTextPane();
f.setContentType("text/html"); // let the text pane know this is what you want
f.setText("<html>Hello World</html>"); // showing off
f.setEditable(false); // as before
f.setBackground(null); // this is the same as a JLabel
f.setBorder(null); // remove the border
代码示例来源:origin: wiztools/rest-client
JTextPane jtp = new JTextPane();
jtp.setEditable(false);
jtp.setContentType("text/html");
jtp.setText(MessageI18N.getMessage("menu.help.about"));
jp_center.add(new JScrollPane(jtp));
代码示例来源:origin: chewiebug/GCViewer
private void initComponents(String fileName) {
super.initComponents();
JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setContentType("text/html");
textPane.addHyperlinkListener(new HyperlinkAdapter(this));
try {
textPane.setText(readFile(fileName));
textPane.setCaretPosition(0);
}
catch (IOException e) {
e.printStackTrace();
}
JScrollPane scrollPane = new JScrollPane(
textPane,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
getContentPane().add("Center", scrollPane);
pack();
}
代码示例来源: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: ron190/jsql-injection
this.result.setContentType("text/html");
this.result.setEditorKit(new HTMLEditorKitTextPaneWrap());
代码示例来源:origin: RaiMan/SikuliX2
jtp.setContentType("text/html");
jtp.setFont(new Font(Font.DIALOG, Font.PLAIN, 14));
if (!header.isEmpty()) {
代码示例来源:origin: magefree/mage
public void showDialog(int min, int max, String message) {
this.spnAmount.setModel(new SpinnerNumberModel(min, min, max, 1));
this.lblMessage.setContentType("text/html");
this.lblMessage.setText(message);
this.btnOk.setVisible(true);
代码示例来源:origin: ron190/jsql-injection
browser.setContentType("text/html");
browser.setEditable(false);
代码示例来源:origin: ron190/jsql-injection
PanelConsoles.NETWORK_TAB_SOURCE.setLineWrap(true);
PanelConsoles.NETWORK_TAB_PREVIEW.setContentType("text/html");
PanelConsoles.NETWORK_TAB_PREVIEW.setEditable(false);
代码示例来源:origin: net.sf.taverna.t2.ui-exts/perspective-biocatalogue
/**
* This method initializes tpOutputPane
*
* @return javax.swing.JTextPane
*/
private JTextPane getTpOutputPane() {
if (tpOutputPane == null) {
tpOutputPane = new JTextPane();
tpOutputPane.setContentType("text/plain");
}
return tpOutputPane;
}
代码示例来源:origin: UISpec4J/UISpec4J
private JTextPane createHtmlTextPane() {
JTextPane dummyPane = new JTextPane();
dummyPane.setContentType("text/html; charset=UTF-8");
return dummyPane;
}
代码示例来源:origin: stackoverflow.com
String text = new String("Hello");
String htmlText = new String("<html><font color='red'>" + text + "</font></html>");
JTextPane jTextPane =new JTextPane ();
jTextPane.setContentType("text/html");
jTextPane.setText(htmlText );
代码示例来源:origin: stackoverflow.com
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextPane textPane = new JTextPane();
System.out.println(String.valueOf("\u2622"));
textPane.setContentType("text/html");
textPane.setText("c'est " + String.valueOf("\u2622"));
frame.getContentPane().add(textPane, BorderLayout.CENTER);
frame.pack(); // Add these
frame.setVisible(true); // two lines
}
代码示例来源:origin: stackoverflow.com
JTextPane myTextPane = new JTextPane();
myTextPane.setContentType("text/html");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<html>");
stringBuilder.append("<b>bold text </b>");
stringBuilder.append("normal text");
stringBuilder.append("</html>");
myTextPane.setText(stringBuilder.toString());
代码示例来源:origin: MegaMek/mekhq
private void initComponents() {
txtReport = new JTextPane();
txtReport.setContentType("text/html");
setLayout(new java.awt.BorderLayout());
txtReport.setEditable(false);
getContentPane().add(new JScrollPane(txtReport), BorderLayout.CENTER);
}
代码示例来源:origin: stackoverflow.com
JTextPane f = new JTextPane();
f.setContentType("text/html"); // let the text pane know this is what you want
f.setEditable(false); // as before
f.setBackground(null); // this is the same as a JLabel
f.setBorder(null); // remove the border
代码示例来源:origin: igvteam/igv
public BlatQueryWindow(Component parent, String querySequence, java.util.List<PSLRecord> records) {
if(parent != null) this.setLocationRelativeTo(parent);
model = new BlatTableModel(records);
initComponents();
addSelectionListener();
querySeqTextPane.setContentType("text/html");
StringBuffer headerBuffer = new StringBuffer("<html>");
headerBuffer.append(" BLAT result for query sequence: <br>   ");
headerBuffer.append(querySequence);
headerBuffer.append("<br><br> <i>Click on a row to go to alignment");
querySeqTextPane.setText(headerBuffer.toString());
}
代码示例来源:origin: stackoverflow.com
JTextPane textPane = new JTextPane();
textPane.setContentType( "text/html" );
textPane.setEditable(false);
HTMLDocument doc = (HTMLDocument)textPane.getDocument();
HTMLEditorKit editorKit = (HTMLEditorKit)textPane.getEditorKit();
String text = "<a href=\"abc\">hyperlink</a>";
editorKit.insertHTML(doc, doc.getLength(), text, 0, 0, null);
代码示例来源:origin: MegaMek/megamek
public static void setupStylesheet(JTextPane pane) {
pane.setContentType("text/html");
Font font = UIManager.getFont("Label.font");
((HTMLEditorKit) pane.getEditorKit()).getStyleSheet().addRule(
"pre { font-family: " + font.getFamily()
+ "; font-size: 12pt; font-style:normal;}");
}
}
代码示例来源:origin: MegaMek/megamek
public static void setupStylesheet(JTextPane pane) {
pane.setContentType("text/html");
Font font = UIManager.getFont("Label.font");
((HTMLEditorKit) pane.getEditorKit()).getStyleSheet().addRule(
"pre { font-family: " + font.getFamily() + "; font-size: 12pt; font-style:normal;}");
}
内容来源于网络,如有侵权,请联系作者删除!