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
JTextPane jtp = new JTextPane(); jtp.setEditable(false); jtp.setContentType("text/html"); jtp.setText(MessageI18N.getMessage("menu.help.about")); jp_center.add(new JScrollPane(jtp));
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(); }
@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; } }
this.result.setContentType("text/html"); this.result.setEditorKit(new HTMLEditorKitTextPaneWrap());
jtp.setContentType("text/html"); jtp.setFont(new Font(Font.DIALOG, Font.PLAIN, 14)); if (!header.isEmpty()) {
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);
browser.setContentType("text/html"); browser.setEditable(false);
PanelConsoles.NETWORK_TAB_SOURCE.setLineWrap(true); PanelConsoles.NETWORK_TAB_PREVIEW.setContentType("text/html"); PanelConsoles.NETWORK_TAB_PREVIEW.setEditable(false);
/** * This method initializes tpOutputPane * * @return javax.swing.JTextPane */ private JTextPane getTpOutputPane() { if (tpOutputPane == null) { tpOutputPane = new JTextPane(); tpOutputPane.setContentType("text/plain"); } return tpOutputPane; }
private JTextPane createHtmlTextPane() { JTextPane dummyPane = new JTextPane(); dummyPane.setContentType("text/html; charset=UTF-8"); return dummyPane; }
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 );
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 }
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());
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); }
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
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()); }
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);
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;}"); } }
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;}"); }