本文整理了Java中javax.swing.JTextPane.setFont()
方法的一些代码示例,展示了JTextPane.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setFont()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setFont
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
private void setFont() {
if (tlp instanceof ChineseTreebankLanguagePack) {
setChineseFont();
} else {
textPane.setFont(new Font("Sans Serif", Font.PLAIN, 14));
treePanel.setFont(new Font("Sans Serif", Font.PLAIN, 14));
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void setChineseFont() {
java.util.List<Font> fonts = FontDetector.supportedFonts(FontDetector.CHINESE);
if (fonts.size() > 0) {
Font font = new Font(fonts.get(0).getName(), Font.PLAIN, 14);
textPane.setFont(font);
treePanel.setFont(font);
log.info("Selected font " + font);
} else if (FontDetector.hasFont("Watanabe Mincho")) {
textPane.setFont(new Font("Watanabe Mincho", Font.PLAIN, 14));
treePanel.setFont(new Font("Watanabe Mincho", Font.PLAIN, 14));
} else {
textPane.setFont(new Font("Sans Serif", Font.PLAIN, 14));
treePanel.setFont(new Font("Sans Serif", Font.PLAIN, 14));
}
}
代码示例来源:origin: libgdx/libgdx
sampleTextPane.setFont(unicodeFont.getFont().deriveFont((float)size));
代码示例来源:origin: libgdx/libgdx
sampleTextPane.setFont(unicodeFont.getFont().deriveFont((float)size));
代码示例来源:origin: marytts/marytts
/**
* Updates the prompt display with the current prompt text
*
* @param text
* The current prompt text for the speaker to read
* @param nextSentence
* nextSentence
* @param redAlertMode
* redAlertMode
*/
public void updatePromptDisplay(String text, String nextSentence, boolean redAlertMode) {
jTextPane_PromptDisplay.setFont(defaultPromptFont);
LookAndFeel.centerPromptText(this.jTextPane_PromptDisplay, text, redAlertMode);
LookAndFeel.centerPromptText(this.jTextPane_nextSentence, nextSentence, redAlertMode);
}
代码示例来源:origin: groovy/groovy-core
PRINT_PANE.setFont(getFont());
PRINT_SIZE.setSize(paper.getImageableWidth(),
getSize().getHeight());
代码示例来源:origin: marytts/marytts
jTextPane_PromptDisplay.setFont(new java.awt.Font("Tahoma", 0, 36));
jTextPane_PromptDisplay
.setText("This is a long and boring test sentence, the only purpose of which is to see how to break between lines without making any difference across the windows.");
jTextPane_nextSentence.setBackground(new java.awt.Color(245, 245, 245));
jTextPane_nextSentence.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextPane_nextSentence.setFont(new java.awt.Font("Tahoma", 0, 24));
jTextPane_nextSentence.setForeground(new java.awt.Color(50, 50, 50));
jTextPane_nextSentence
代码示例来源:origin: marytts/marytts
jTextPane_PromptDisplay.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextPane_PromptDisplay.setEditable(false);
jTextPane_PromptDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
jTextPane_PromptDisplay
.setText("This is a long and boring test sentence, the only purpose of which is to see how to break between lines without making any difference across the windows.");
jTextPane_nextSentence.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextPane_nextSentence.setEditable(false);
jTextPane_nextSentence.setFont(new java.awt.Font("Tahoma", 0, 24));
jTextPane_nextSentence.setForeground(new java.awt.Color(50, 50, 50));
jTextPane_nextSentence
代码示例来源:origin: marytts/marytts
nextPromptTranscription = nextPromptTranscription + ">";
jTextPane_PromptDisplay.setFont(defaultPromptFont);
if (this.isVisible()) {
if (!showTranscription) {
代码示例来源:origin: apache/pdfbox
private void initUI(StyledDocument document)
{
mainPanel = new JPanel();
textPane = new JTextPane(document);
textPane.addMouseMotionListener(this);
textPane.setFont(new Font("monospaced", Font.PLAIN, 13));
searcher = new Searcher(textPane);
JScrollPane scrollPane = new JScrollPane(textPane);
BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
mainPanel.setLayout(boxLayout);
mainPanel.add(searcher.getSearchPanel());
mainPanel.add(scrollPane);
searcher.getSearchPanel().setVisible(false);
mainPanel.addAncestorListener(this);
}
代码示例来源:origin: dboissier/mongo4idea
void notifyOnErrorForOperator(final JComponent component, Exception ex) {
String message;
if (ex instanceof JSONParseException) {
message = StringUtils.removeStart(ex.getMessage(), "\n");
} else {
message = String.format("%s: %s", ex.getClass().getSimpleName(), ex.getMessage());
}
final NonOpaquePanel nonOpaquePanel = new NonOpaquePanel();
JTextPane textPane = Messages.configureMessagePaneUi(new JTextPane(), message);
textPane.setFont(COURIER_FONT);
textPane.setBackground(MessageType.ERROR.getPopupBackground());
nonOpaquePanel.add(textPane, BorderLayout.CENTER);
nonOpaquePanel.add(new JLabel(MessageType.ERROR.getDefaultIcon()), BorderLayout.WEST);
UIUtil.invokeLaterIfNeeded(() ->
JBPopupFactory.getInstance().createBalloonBuilder(nonOpaquePanel)
.setFillColor(MessageType.ERROR.getPopupBackground())
.createBalloon()
.show(new RelativePoint(component, new Point(0, 0)), Balloon.Position.above)
);
}
代码示例来源:origin: magefree/mage
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
text = new javax.swing.JTextPane();
setMinimumSize(getPreferredSize());
setOpaque(false);
setPreferredSize(new Dimension(dimension.frameWidth, dimension.frameHeight));
setLayout(null);
jScrollPane1.setBorder(null);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setFocusable(false);
jScrollPane1.setOpaque(false);
text.setBorder(null);
text.setEditable(false);
text.setFont(new java.awt.Font("Arial", 0, 9));
text.setFocusable(false);
text.setOpaque(false);
jScrollPane1.setViewportView(text);
add(jScrollPane1);
jScrollPane1.setBounds(20, 110, 130, 100);
jScrollPane1.setBounds(new Rectangle(dimension.contentXOffset, dimension.textYOffset, dimension.textWidth, dimension.textHeight));
}// </editor-fold>//GEN-END:initComponents
代码示例来源:origin: pentaho/mondrian
queryTextPane.setFont(new java.awt.Font("Courier New", 0, 12));
queryTextPane.setText("");
queryTextPane.addMouseListener(
resultTextPane.setFont(new java.awt.Font("Courier New", 0, 12));
jScrollPane2.setViewportView(resultTextPane);
代码示例来源:origin: nodebox/nodebox
JTextPane consoleMessages = new JTextPane();
consoleMessages.setMargin(new Insets(2, 20, 2, 5));
consoleMessages.setFont(Theme.EDITOR_FONT);
consoleMessages.setEditable(false);
consoleMessages.addMouseListener(new MouseAdapter() {
代码示例来源:origin: RaiMan/SikuliX2
jtp.setFont(new Font(Font.DIALOG, Font.PLAIN, 14));
if (!header.isEmpty()) {
aText = String.format(header, jtp.getFont().getFamily()) + aText;
代码示例来源:origin: igvteam/igv
private void updateFont() {
String fontName = (String) fontList.getSelectedValue();
int size = Integer.parseInt((String) sizeComboBox.getSelectedItem());
boolean isBold = boldCB.isSelected();
boolean isItalic = italicCB.isSelected();
int attrs = Font.PLAIN;
if (isBold) attrs = Font.BOLD;
if (isItalic) attrs |= Font.ITALIC;
selectedFont = new Font(fontName, attrs, size);
this.exampleLabel.setFont(selectedFont);
}
代码示例来源:origin: ron190/jsql-injection
StyleConstants.setFontFamily(SwingAppender.ALL, HelperUi.FONT_NAME_UBUNTU_REGULAR);
MediatorGui.managerBruteForce().getResult().setFont(HelperUi.FONT_UBUNTU_REGULAR);
StyleConstants.setFontFamily(SwingAppender.ALL, HelperUi.FONT_NAME_UBUNTU_MONO);
MediatorGui.managerBruteForce().getResult().setFont(HelperUi.FONT_UBUNTU_MONO);
代码示例来源:origin: igvteam/igv
private void init(Font font) {
selectedFont = font;
String[] fontFamilies = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
this.fontList.setListData(fontFamilies);
String family = font.getFamily();
fontList.setSelectedValue(font.getFamily(), true);
sizeComboBox.setSelectedItem(String.valueOf(font.getSize()));
exampleLabel.setFont(font);
}
代码示例来源:origin: protegeproject/protege
private void setupFont() {
plainFont = OWLRendererPreferences.getInstance().getFont();
boldFont = plainFont.deriveFont(Font.BOLD);
textPane.setFont(plainFont);
}
代码示例来源:origin: ontop/ontop
private void setupFont() {
plainFont = new Font("Lucida Grande", Font.PLAIN, 14);
plainFontHeight = trgQueryTextPane.getFontMetrics(plainFont).getHeight();
int[] widths = trgQueryTextPane.getFontMetrics(plainFont).getWidths();
int sum = 0;
for (int i = 0; i < widths.length; i++) {
int j = widths[i];
sum += j;
}
plainFontWidth = sum / widths.length;
trgQueryTextPane.setFont(plainFont);
}
内容来源于网络,如有侵权,请联系作者删除!