List of usage examples for javax.swing JTextPane setContentType
@BeanProperty(bound = false, description = "the type of content") public final void setContentType(String type)
From source file:org.zaproxy.zap.extension.customFire.ExtensionCustomFire.java
private AbstractPanel getStatusPanel() { if (statusPanel == null) { statusPanel = new AbstractPanel(); statusPanel.setLayout(new CardLayout()); statusPanel.setName(Constant.messages.getString(PREFIX + ".panel.title")); statusPanel.setIcon(ICON);/*from w ww . j av a 2 s. co m*/ JTextPane pane = new JTextPane(); pane.setEditable(false); pane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12)); pane.setContentType("text/html"); pane.setText(Constant.messages.getString(PREFIX + ".panel.msg")); statusPanel.add(pane); } return statusPanel; }
From source file:tufts.vue.ui.InspectorPane.java
private static JComponent buildSummary(final Resource r, final MetaMap data) { final JTextPane htmlText = new JTextPane(); htmlText.setEditable(false);/*w w w .j av a2s. c om*/ htmlText.setContentType("text/html"); htmlText.setName("description:" + r); htmlText.addHyperlinkListener(DefaultHyperlinkListener); //final MetaMap data = (node == null ? null : node.getRawData()); final String desc = findProperty(r, data, "descriptionSummary", "Description", "Summary"); final String summary; if (desc != null || r == null) { summary = buildSummaryWithDescription(r, data, desc); if (summary == null || summary.length() == 0) return null; //htmlText.setText("No Description");// todo: should just hide panel else htmlText.setText(summary); if (DEBUG.DATA && data != null) data.put("$reformatted", "[" + summary + "]"); } else { //if (r != null) { //------------------------------------------------------------------ // No description was found: build a summary from just the Resource //------------------------------------------------------------------ summary = buildSummaryFromResource(r); htmlText.setText(summary); if (DEBUG.DATA) r.setProperty("~reformatted", summary); } //else return null; // This must be done last. Why this doesn't work up front I don't know: there // must be some other way... GUI.setDocumentFont(htmlText, GUI.ContentFace); return htmlText; // if (loader != null) { // // this not actually helping, other than we get to see "Loading..." before it hangs. // final Thread _loader = loader; // GUI.invokeAfterAWT(new Runnable() { public void run() { // _loader.start(); // }}); // } }