JEditorPane pane = new JEditorPane(); pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); pane.setFont(SOME_FONT);
JEditorPane pane = new JEditorPane(); pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); pane.setFont(someOrdinaryLabel.getFont());
/** * Enforces JEditorPane font. * Once the content type of a JEditorPane is set to text/html the font on the Pane starts to be managed by Swing. * This method forces using provided font. */ public static void enforceJEditorPaneFont(JEditorPane jEditorPane, Font font) { jEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); jEditorPane.setFont(font); }
@Override public void setFont(Font font) { super.setFont(font); applyTitle(); }
/** Set to a sane font (not proportional!). */ @Override public void install(JEditorPane pane) { super.install(pane); pane.setFont(new Font("Monospaced", Font.PLAIN, pane.getFont().getSize() + 1)); //NOI18N } }
/** Set to a sane font (not proportional!). */ public void install (JEditorPane pane) { super.install (pane); pane.setFont (new Font ("Monospaced", Font.PLAIN, pane.getFont().getSize() + 1)); //NOI18N } }
/** Set to a sane font (not proportional!). */ public void install (JEditorPane pane) { super.install (pane); pane.setFont (new Font ("Monospaced", Font.PLAIN, pane.getFont().getSize() + 1)); //NOI18N } }
@Override public void setFont(Font font) { super.setFont(font); setFontHeightWidth(getFont()); }
private JEditorPane createTextPanel() { JEditorPane pane = new JEditorPane(); pane.setBorder(new EmptyBorder(12, 12, 12, 12)); pane.setPreferredSize(new Dimension(300, 200)); pane.setEditable(false); pane.setFont(new Font("SansSerif", Font.PLAIN, 9)); pane.addHyperlinkListener(new HyperlinkListener(){ public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && event.getURL() != null) { NativeBrowserLauncher.openURL(event.getURL().toString()); } } }); return pane; }
/** Overriden to set the JEditorPane font to match with the XMLContext * {@inheritDoc} */ public void install(JEditorPane c) { super.install(c); Object obj = context.getSyntaxFont(XMLContext.DEFAULT_STYLE); if (obj != null) { c.setFont((Font)obj); } }
@Override public void setFont(Font font) { super.setFont(font); Document3 doc = getOmDocument(); if (doc != null) { doc.setFont(font); } }
private JEditorPane createTextPanel() { JEditorPane pane = new JEditorPane(); pane.setBorder(new EmptyBorder(12, 12, 12, 12)); pane.setPreferredSize(new Dimension(300, 200)); pane.setEditable(false); pane.setFont(new Font("SansSerif", Font.PLAIN, 9)); pane.addHyperlinkListener(new HyperlinkListener(){ public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && event.getURL() != null) { NativeBrowserLauncher.openURL(event.getURL().toString()); } } }); return pane; }
/** Overriden to set the JEditorPane font to match with the XMLContext * {@inheritDoc} */ public void install(JEditorPane c) { super.install(c); Object obj = context.getSyntaxFont(XMLContext.DEFAULT_STYLE); if (obj != null) { c.setFont((Font)obj); } }
/** * This method initializes descriptionEditorPane * * @return javax.swing.JEditorPane */ private JEditorPane getDescriptionEditorPane() { if (descriptionEditorPane == null) { descriptionEditorPane = new JEditorPane(); descriptionEditorPane.setSize(new Dimension(546, 128)); descriptionEditorPane.setBackground(SystemColor.control); descriptionEditorPane.setPreferredSize(new Dimension(48, 48)); descriptionEditorPane.setText(""); descriptionEditorPane.setEditable(false); descriptionEditorPane.setContentType("text/html"); descriptionEditorPane.setFont(new Font("SansSerif", Font.PLAIN, 12)); } return descriptionEditorPane; }
private void initSourceEditor() { sourceEditorPane.setEditorKit(MimeLookup.getLookup(HTML_CONTENT_TYPE).lookup(EditorKit.class)); // ui Font font = new JLabel().getFont(); sourceEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); sourceEditorPane.setFont(font); previewTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); previewTextPane.setFont(font); }
protected AboutUIBuilder addTab0(String tabTitle, String tabContent, boolean html) { JScrollPane scrollPane = new JScrollPane(); scrollPane.setBorder(null); JTabbedPane tabs = ui.getTabs(); tabs.addTab(tabTitle, scrollPane); final JEditorPane jEditorPane = new JEditorPane(); jEditorPane.setBorder(null); if (html) { // must be done before set in text jEditorPane.setContentType("text/html"); } jEditorPane.setText(tabContent); jEditorPane.setEditable(false); jEditorPane.setFont(jEditorPane.getFont().deriveFont((float) 11)); jEditorPane.addHyperlinkListener(SwingUtil::openLink); scrollPane.getViewport().add(jEditorPane); SwingUtilities.invokeLater(() -> jEditorPane.setCaretPosition(0)); return this; }
public SwingTextDisplayPanel(final TextDisplay display, final DisplayWindow window) { display.getContext().inject(this); this.display = display; this.window = window; textArea = new JEditorPane(); textArea.setPreferredSize(new Dimension(600, 500)); textArea.setEditable(false); final Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12); textArea.setFont(font); textArea.addHyperlinkListener(this); setViewportView(textArea); window.setContent(this); }
JEditorPane dtrpnTypeTextHere = new JEditorPane(); dtrpnTypeTextHere.setContentType("type/normal"); dtrpnTypeTextHere.setToolTipText(""); dtrpnTypeTextHere.setFont(new Font("Arial", Font.PLAIN, 16)); dtrpnTypeTextHere.setForeground(Color.GREEN); dtrpnTypeTextHere.setBackground(Color.BLACK); dtrpnTypeTextHere.setBounds(10, 23, 1152, 671); contentPane.add(dtrpnTypeTextHere); int length = dtrpnTypeTextHere.getDocument().getLength(); String text = dtrpnTypeTextHere.getDocument().getText(0, length);