本文整理了Java中javax.swing.JTextArea.setLineWrap()
方法的一些代码示例,展示了JTextArea.setLineWrap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setLineWrap()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setLineWrap
暂无
代码示例来源: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: bonnyfone/vectalign
private String showInputDialog(String title, String defaultText){
JTextArea msg = new JTextArea(defaultText);
msg.setLineWrap(true);
msg.setWrapStyleWord(true);
JScrollPane scrollPane = new JScrollPane(msg);
scrollPane.setPreferredSize(new Dimension(600, 250));
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
int ris = JOptionPane.showConfirmDialog(null, scrollPane, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if(ris == JOptionPane.OK_OPTION)
return msg.getText();
else
return defaultText;
}
代码示例来源:origin: spotbugs/spotbugs
public TestDesktopIntegration() {
setLayout(new BorderLayout());
JPanel top = new JPanel();
top.setLayout(new FlowLayout());
add(top, SHOW_CONSOLE ? BorderLayout.NORTH : BorderLayout.CENTER);
JScrollPane scrollPane = new JScrollPane(console, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
console.setEditable(false);
console.setLineWrap(true);
add(scrollPane);
} else {
代码示例来源:origin: marytts/marytts
lSize = new javax.swing.JLabel();
lSizeValue = new javax.swing.JLabel();
spDescription = new javax.swing.JScrollPane();
taDescription = new javax.swing.JTextArea();
lStatus = new javax.swing.JLabel();
lStatusValue = new javax.swing.JLabel();
taDescription.setEditable(false);
taDescription.setFont(new java.awt.Font("Courier New", 0, 10));
taDescription.setLineWrap(true);
taDescription.setRows(2);
taDescription.setText(desc.getDescription());
代码示例来源:origin: geotools/geotools
/** {@inheritDoc} */
@Override
public JPanel createControlPanel() {
JPanel panel = new JPanel(new BorderLayout());
categoryList = new JList(new CategoryListModel());
categoryList.setPreferredSize(new Dimension(LIST_WIDTH, DEFAULT_HEIGHT));
categoryList.setBorder(BorderFactory.createTitledBorder("Categories"));
categoryList.addListSelectionListener(
new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
showInfo(categoryList.getSelectedIndex());
}
});
panel.add(categoryList, BorderLayout.WEST);
textArea = new JTextArea();
textArea.setPreferredSize(new Dimension(TEXT_AREA_WIDTH, DEFAULT_HEIGHT));
textArea.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
textArea.setLineWrap(true);
textArea.setEditable(false);
panel.add(textArea, BorderLayout.CENTER);
categoryList.setSelectedIndex(0);
return panel;
}
代码示例来源:origin: pmd/pmd
gbc.anchor = GridBagConstraints.WEST;
gbc.weightx = 0.5;
ruledescField.setLineWrap(true);
gbl.setConstraints(ruledescField, gbc);
add(ruledescField);
gbc.weightx = 1.0;
gbc.weighty = 1.0;
JScrollPane ruleXMLPane = new JScrollPane(ruleXMLArea);
gbl.setConstraints(ruleXMLPane, gbc);
add(ruleXMLPane);
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500 , 200);
frame.setVisible(true);
frame.setTitle("Java");
JTextArea textarea = new JTextArea();
textarea.setEditable(false);
textarea.setLineWrap(true);
JTextField field = new JTextField();
field.setText("Hi! This is the text!");
frame.add(textarea); // <-- here
frame.add(field);
代码示例来源:origin: jshiell/checkstyle-idea
/**
* Initialise the view.
*/
private void initialise() {
// fake a multi-line label with a text area
descriptionLabel.setText(CheckStyleBundle.message("config.inspection.description"));
descriptionLabel.setEditable(false);
descriptionLabel.setEnabled(false);
descriptionLabel.setWrapStyleWord(true);
descriptionLabel.setLineWrap(true);
descriptionLabel.setOpaque(false);
descriptionLabel.setDisabledTextColor(descriptionLabel.getForeground());
final GridBagConstraints descLabelConstraints = new GridBagConstraints(
0, 0, 3, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, JBUI.insets(4), 0, 0);
add(descriptionLabel, descLabelConstraints);
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createDescriptionPanel() {
JPanel descriptionPanel = new JPanel(new BorderLayout(2, 2));
descriptionPanel.add(new JLabel("Description"), BorderLayout.NORTH);
descriptionTextArea = new JTextArea(8, 65);
descriptionTextArea.setEditable(false);
descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true);
descriptionPanel.add(new JScrollPane(descriptionTextArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
return descriptionPanel;
}
代码示例来源:origin: marytts/marytts
lSize = new javax.swing.JLabel();
lSizeValue = new javax.swing.JLabel();
spDescription = new javax.swing.JScrollPane();
taDescription = new javax.swing.JTextArea();
lStatus = new javax.swing.JLabel();
lStatusValue = new javax.swing.JLabel();
taDescription.setEditable(false);
taDescription.setFont(new java.awt.Font("Courier New", 0, 10));
taDescription.setLineWrap(true);
taDescription.setRows(2);
taDescription.setText(desc.getDescription());
代码示例来源:origin: geotools/geotools
@Override
public JPanel createControlPanel() {
textArea.setEditable(false);
textArea.setLineWrap(true);
textArea.setAutoscrolls(true);
JScrollPane scrollPane = new JScrollPane(textArea);
JPanel panel = new JPanel(new MigLayout("wrap 1", "[grow]", "[grow][]"));
panel.add(scrollPane, "grow");
return panel;
}
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea("Insert your Text here");
JScrollPane scrollPane = new JScrollPane(textArea);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
scrollPane.setPreferredSize( new Dimension( 500, 500 ) );
JOptionPane.showMessageDialog(null, scrollPane, "dialog test with textarea",
JOptionPane.YES_NO_OPTION);
代码示例来源:origin: winder/Universal-G-Code-Sender
private void initComponents() {
// MigLayout... 3rd party layout library.
setLayout(new MigLayout("fillx, wrap 2, inset 5", "grow"));
add(rowsLabel, AL_RIGHT);
add(rowsValue);
add(sentRowsLabel, AL_RIGHT);
add(sentRowsValue);
add(remainingRowsLabel, AL_RIGHT);
add(remainingRowsValue);
add(remainingTimeLabel, AL_RIGHT);
add(remainingTimeValue);
add(durationLabel, AL_RIGHT);
add(durationValue);
add(latestCommentLabel, "span 2, wrap");
add(latestCommentValueLabel, "growx, span 2, wrap, wmin 10");
latestCommentValueLabel.setOpaque(false);
latestCommentValueLabel.setWrapStyleWord(true);
latestCommentValueLabel.setLineWrap(true);
}
代码示例来源: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: marytts/marytts
lNameValue3 = new javax.swing.JLabel();
lName3 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
lName4 = new javax.swing.JLabel();
lNameValue4 = new javax.swing.JLabel();
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Courier New", 0, 10));
jTextArea1.setLineWrap(true);
jTextArea1.setRows(2);
jTextArea1.setText(desc.getDescription());
代码示例来源:origin: stackoverflow.com
JTextArea msg = new JTextArea("This is a really silly example of what can be achieved with a JOptionPane, but this is going to excese for what you have asked for");
msg.setLineWrap(true);
msg.setWrapStyleWord(true);
JScrollPane scrollPane = new JScrollPane(msg);
JOptionPane.showMessageDialog(null, scrollPane);
代码示例来源:origin: libgdx/libgdx
((JSpinner.DefaultEditor)((JSpinner)component).getEditor()).getTextField().setColumns(4);
descriptionPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black));
JTextArea descriptionText = new JTextArea(description);
descriptionPanel.add(descriptionText, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
descriptionText.setWrapStyleWord(true);
descriptionText.setLineWrap(true);
descriptionText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
descriptionText.setEditable(false);
JPanel panel = new JPanel();
getContentPane().add(
panel,
new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 0,
panel.add(component);
JPanel buttonPanel = new JPanel();
getContentPane().add(
buttonPanel,
new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
代码示例来源:origin: marytts/marytts
lNameValue3 = new javax.swing.JLabel();
lName3 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
lName4 = new javax.swing.JLabel();
lNameValue4 = new javax.swing.JLabel();
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Courier New", 0, 10));
jTextArea1.setLineWrap(true);
jTextArea1.setRows(2);
jTextArea1.setText(desc.getDescription());
代码示例来源: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: libgdx/libgdx
((JSpinner.DefaultEditor)((JSpinner)component).getEditor()).getTextField().setColumns(4);
descriptionPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black));
JTextArea descriptionText = new JTextArea(description);
descriptionPanel.add(descriptionText, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
descriptionText.setWrapStyleWord(true);
descriptionText.setLineWrap(true);
descriptionText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
descriptionText.setEditable(false);
JPanel panel = new JPanel();
getContentPane().add(
panel,
new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 0,
panel.add(component);
JPanel buttonPanel = new JPanel();
getContentPane().add(
buttonPanel,
new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
内容来源于网络,如有侵权,请联系作者删除!