本文整理了Java中javax.swing.JTextArea.setFont()
方法的一些代码示例,展示了JTextArea.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setFont()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setFont
暂无
代码示例来源:origin: log4j/log4j
protected JTextArea createDetailTextArea() {
JTextArea detailTA = new JTextArea();
detailTA.setFont(new Font("Monospaced", Font.PLAIN, 14));
detailTA.setTabSize(3);
detailTA.setLineWrap(true);
detailTA.setWrapStyleWord(false);
return (detailTA);
}
代码示例来源:origin: dcevm/dcevm
private JComponent getCenterPanel() {
JPanel center = new JPanel(new BorderLayout());
center.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
center.setBackground(Color.WHITE);
JTextArea license = new javax.swing.JTextArea();
license.setLineWrap(true);
license.setWrapStyleWord(true);
license.setEditable(false);
license.setFont(license.getFont().deriveFont(11.0f));
StringBuilder licenseText = new StringBuilder();
licenseText.append("Enhance current Java (JRE/JDK) installations with DCEVM (http://github.com/dcevm/dcevm).");
licenseText.append("\n\nYou can either replace current Java VM or install DCEVM as alternative JVM (run with -XXaltjvm=dcevm command-line option).");
licenseText.append("\nInstallation as alternative JVM is preferred, it gives you more control where you will use DCEVM.\nWhy this is important? Because DCEVM forces your JVM to use only one GC algorithm, and this may cause performance penalty.");
licenseText.append("\n\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation.\n\nThis code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.");
licenseText.append("\n\n\nASM LICENSE TEXT:\nCopyright (c) 2000-2005 INRIA, France Telecom\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
license.setText(licenseText.toString());
JScrollPane licenses = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
licenses.setPreferredSize(new Dimension(150, 150));
center.add(licenses, BorderLayout.NORTH);
center.add(getChooserPanel(), BorderLayout.CENTER);
return center;
}
代码示例来源:origin: redwarp/9-Patch-Resizer
public AboutDialog(JFrame parent) {
this.setResizable(false);
this.setSize(new Dimension(400, 250));
this.getContentPane().setLayout(new BorderLayout(0, 0));
JLabel lblResizer = new JLabel(Localization.get("app_name") + " "
+ Configuration.getVersion());
lblResizer.setBorder(new EmptyBorder(10, 10, 10, 10));
lblResizer.setVerticalTextPosition(SwingConstants.BOTTOM);
lblResizer.setIconTextGap(10);
lblResizer.setFont(lblResizer.getFont().deriveFont(
lblResizer.getFont().getStyle() | Font.BOLD, 16f));
lblResizer.setIcon(new ImageIcon(AboutDialog.class
.getResource("/img/icon_64.png")));
this.getContentPane().add(lblResizer, BorderLayout.NORTH);
JTextArea txtrResizerIsA = new JTextArea();
txtrResizerIsA.setEditable(false);
txtrResizerIsA.setWrapStyleWord(true);
txtrResizerIsA.setBorder(new EmptyBorder(0, 10, 10, 10));
txtrResizerIsA.setFont(UIManager.getFont("Label.font"));
txtrResizerIsA.setLineWrap(true);
txtrResizerIsA.setText(Localization.get("about_text"));
txtrResizerIsA.setBackground(new Color(0, 0, 0, 0));
this.getContentPane().add(txtrResizerIsA, BorderLayout.CENTER);
this.setLocationRelativeTo(parent);
}
代码示例来源:origin: plantuml/plantuml
public SpriteWindow() {
super("SpriteWindows");
setIconImage(PSystemVersion.getPlantumlSmallIcon2());
// encode.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent ae) {
// encode();
// }
// });
area.setFont(new Font("Courier", Font.PLAIN, 14));
area.setText("Copy an image to the clipboard.\nIt will be converted inside this window.\n");
final JScrollPane scroll = new JScrollPane(area);
// getContentPane().add(encode, BorderLayout.SOUTH);
getContentPane().add(scroll, BorderLayout.CENTER);
setSize(400, 320);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
startTimer();
}
代码示例来源:origin: stackoverflow.com
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel = new JPanel();
JTextArea textArea = new JTextArea(
"If there is anything the nonconformist hates worse " +
"than a conformist, it's another nonconformist who " +
6,
20);
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
代码示例来源:origin: com.io7m.r2/io7m-r2-examples
ExampleProfilingWindow()
{
super("Profiling");
this.text = new JTextArea();
this.text.setFont(Font.decode("Monospace 10"));
final JScrollPane scroll = new JScrollPane(this.text);
final Container cp = this.getContentPane();
cp.add(scroll);
this.setPreferredSize(new Dimension(640, 480));
this.pack();
}
代码示例来源:origin: stackoverflow.com
this.alpha = alpha;
this.setBackground(new Color(0, 0, 0, alpha));
this.setFont(new Font("Serif", Font.ITALIC, 24));
this.setEditable(false);
this.setText("Twas brillig and the slithy toves,\n"
JPanel panel = new JPanel();
panel.setBackground(new Color(0xffffc0));
panel.add(new TransparentTextArea(0));
代码示例来源:origin: org.codehaus.groovy/groovy
private void jbInit(Reader reader) throws Exception {
final Border border = BorderFactory.createEmptyBorder();
jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
tokenPane.setEditable(false);
tokenPane.setText("");
scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
scriptPane.setEditable(false);
scriptPane.setMargin(new Insets(5, 5, 5, 5));
scriptPane.setText("");
jScrollPane1.setBorder(border);
jScrollPane2.setBorder(border);
jSplitPane1.setMinimumSize(new Dimension(800, 600));
mainPanel.add(jSplitPane1, BorderLayout.CENTER);
if (reader == null) {
mainPanel.add(jbutton, BorderLayout.NORTH);
}
this.getContentPane().add(mainPanel);
jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
jScrollPane1.getViewport().add(tokenPane, null);
jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
jScrollPane2.getViewport().add(scriptPane, null);
jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
jSplitPane1.setResizeWeight(0.5);
}
代码示例来源:origin: SKCraft/Launcher
private void initComponents() {
gameKeysText.setFont(prioritySpinner.getFont());
prioritySpinner.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
gameKeysText.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
JPanel container = new JPanel();
container.setLayout(new MigLayout("insets dialog"));
container.add(includeCheck, "span, gapbottom unrel");
container.add(new JLabel("Priority:"));
container.add(prioritySpinner, "span, split 2, w 50");
container.add(new JLabel("(Greater is higher)"));
container.add(new JLabel("Game Keys:"));
container.add(SwingHelper.wrapScrollPane(gameKeysText), "span");
container.add(okButton, "tag ok, span, split 2, sizegroup bttn, gaptop unrel");
container.add(cancelButton, "tag cancel, sizegroup bttn");
add(container, BorderLayout.CENTER);
getRootPane().setDefaultButton(okButton);
getRootPane().registerKeyboardAction(e -> cancelButton.doClick(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
super(new BorderLayout());
this.contentNumbered = contentNumbered;
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.setFont(UIManager.getFont("Label.font")); // NOI18N
ta.getAccessibleContext().setAccessibleDescription(""); // NOI18N
ta.setBorder(BorderFactory.createEmptyBorder());
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea(
"This is an editable JTextArea. " +
"A text area is a \"plain\" text component, " +
"which means that although it can display text " +
"in any font, all of the text is in the same font."
);
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
代码示例来源:origin: osmdroid/osmdroid
private void initGUI() {
this.setLayout(new BorderLayout());
this.mTxtBatchItems = new JTextArea();
this.add(this.mTxtBatchItems, BorderLayout.CENTER);
this.mTxtBatchItems.setFont(new Font("Tahoma", Font.PLAIN, 8));
this.mBtnStartBatch = new JButton("Run Batch");
this.add(this.mBtnStartBatch, BorderLayout.SOUTH);
this.mBtnStartBatch.addActionListener(new ActionListener(){
@Override
public void actionPerformed(final ActionEvent e) {
freezeUI();
startBatch();
unFreezeUI();
}
});
this.mProgressBar = new JProgressBar();
this.mProgressBar.setStringPainted(true);
this.add(this.mProgressBar, BorderLayout.NORTH);
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected JTextArea createDetailTextArea() {
JTextArea detailTA = new JTextArea();
detailTA.setFont(new Font("Monospaced", Font.PLAIN, 14));
detailTA.setTabSize(3);
detailTA.setLineWrap(true);
detailTA.setWrapStyleWord(false);
return (detailTA);
}
代码示例来源:origin: MegaMek/mekhq
private JPanel genNotes(Campaign c, Person p) {
JPanel panel = new JPanel();
panel.setOpaque(false);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(genLabel(resourceMap.getString("doctorsNotes.text"))); //$NON-NLS-1$
String notes = p.getExtraData().get(DOCTOR_NOTES, ""); //$NON-NLS-1$
notesArea = new JTextArea(notes);
notesArea.setEditable(true);
notesArea.setAlignmentX(Component.LEFT_ALIGNMENT);
notesArea.setFont(handwritingFont);
notesArea.setLineWrap(true);
notesArea.setWrapStyleWord(true);
JPanel notesPanel = new JPanel();
notesPanel.setLayout(new BoxLayout(notesPanel, BoxLayout.X_AXIS));
notesPanel.setOpaque(false);
notesPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
notesPanel.add(Box.createHorizontalStrut(30));
notesPanel.add(notesArea);
panel.add(notesPanel);
return panel;
}
代码示例来源:origin: uk.org.mygrid.taverna.scufl.scufl-ui-components/workflow-input-panel
public DescriptionAndDiagram() {
super(new BorderLayout());
// FIXME: make description wrap lines
JTextArea description = new JTextArea(model.getDescription().getText());
description.setEditable(false);
description.setLineWrap(true);
description.setOpaque(false);
description.setWrapStyleWord(true);
description.setFont(Font.getFont("Dialog"));
// Avoid stealing all width
description.setMinimumSize(new Dimension(25, 10));
// FIXME: detach from model when window is closed
diagram.attachToModel(model);
add(description, BorderLayout.NORTH);
add(diagram, BorderLayout.CENTER);
}
}
代码示例来源:origin: com.io7m.blueberry/io7m-blueberry-gui
GUILogPanel()
{
this.text_area = new JTextArea();
this.text_area.setEditable(false);
this.text_area.setFont(Font.decode(Font.MONOSPACED + " 9"));
this.scrollpane = new JScrollPane(this.text_area);
this.scrollpane
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
final DesignGridLayout tp_layout = new DesignGridLayout(this);
tp_layout.row().grid().add(this.scrollpane);
this.scrollpane.setPreferredSize(this.getSize());
}
代码示例来源:origin: pmd/pmd
xpathQueryArea.setFont(new Font("Verdana", Font.PLAIN, 16));
JSplitPane controlSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, createCodeEditorPanel(),
createXPathQueryPanel());
代码示例来源:origin: stackoverflow.com
JTextArea txt = new JTextArea();
Font font = new Font("Verdana", Font.BOLD, 12);
txt.setFont(font);
txt.setForeground(Color.BLUE);
代码示例来源:origin: deathmarine/Luyten
JPanel pane = new JPanel();
pane.setLayout(new BoxLayout(pane, BoxLayout.PAGE_AXIS));
if (message.contains("\n")) {
final JTextArea exception = new JTextArea(25, 100);
exception.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 10));
exception.setText(stacktrace);
exception.addMouseListener(new MouseAdapter() {
JScrollPane scroll = new JScrollPane(exception);
scroll.setBorder(new CompoundBorder(BorderFactory.createTitledBorder("Stacktrace"),
new BevelBorder(BevelBorder.LOWERED)));
代码示例来源:origin: org.apache.activemq/activemq-all
protected JTextArea createDetailTextArea() {
JTextArea detailTA = new JTextArea();
detailTA.setFont(new Font("Monospaced", Font.PLAIN, 14));
detailTA.setTabSize(3);
detailTA.setLineWrap(true);
detailTA.setWrapStyleWord(false);
return (detailTA);
}
内容来源于网络,如有侵权,请联系作者删除!