本文整理了Java中javax.swing.JEditorPane.setFont()
方法的一些代码示例,展示了JEditorPane.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setFont()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setFont
暂无
代码示例来源:origin: stackoverflow.com
JEditorPane pane = new JEditorPane();
pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
pane.setFont(SOME_FONT);
代码示例来源:origin: stackoverflow.com
JEditorPane pane = new JEditorPane();
pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
pane.setFont(someOrdinaryLabel.getFont());
代码示例来源:origin: org.jodd/jodd-wot
/**
* 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);
}
代码示例来源:origin: com.googlecode.jannocessor/jannocessor-ui
protected void increase() {
logger.info("Increasing font size");
input.setFont(new Font("Courier New", Font.BOLD, input.getFont().getSize() + 1));
editor.setFont(new Font("Courier New", Font.BOLD, editor.getFont().getSize() + 1));
}
代码示例来源:origin: com.eas.platypus/platypus-js-grid
@Override
public void setFont(Font font) {
super.setFont(font);
applyTitle();
}
代码示例来源:origin: com.googlecode.jannocessor/jannocessor-ui
protected void decrease() {
logger.info("Decreasing font size");
input.setFont(new Font("Courier New", Font.BOLD, Math.max(input.getFont().getSize() - 1, 8)));
editor.setFont(new Font("Courier New", Font.BOLD, Math.max(editor.getFont().getSize() - 1, 8)));
}
代码示例来源:origin: org.netbeans.api/org-openide-text
/** 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
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
/** 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
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
/** 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
}
}
代码示例来源:origin: org.netbeans.api/org-openide-text
@Override
public void setFont(Font font) {
super.setFont(font);
setFontHeightWidth(getFont());
}
代码示例来源:origin: org.protege/protege-editor-core-application
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;
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/** 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);
}
}
代码示例来源:origin: omegat-org/omegat
@Override
public void setFont(Font font) {
super.setFont(font);
Document3 doc = getOmDocument();
if (doc != null) {
doc.setFont(font);
}
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application
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;
}
代码示例来源:origin: apache/batik
/** 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);
}
}
代码示例来源:origin: org.jvnet.hudson.plugins.hudsontrayapp/client-common
/**
* 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;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
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);
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-about
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;
}
代码示例来源:origin: org.scijava/scijava-ui-swing
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);
}
代码示例来源:origin: stackoverflow.com
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);
内容来源于网络,如有侵权,请联系作者删除!