javax.swing.JTextArea.setWrapStyleWord()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(500)

本文整理了Java中javax.swing.JTextArea.setWrapStyleWord()方法的一些代码示例,展示了JTextArea.setWrapStyleWord()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setWrapStyleWord()方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setWrapStyleWord

JTextArea.setWrapStyleWord介绍

暂无

代码示例

代码示例来源: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: geotools/geotools

public JComponent doLayout() {
  text = new JTextArea(40, 3);
  text.addKeyListener(
      new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
          validate();
        }
      });
  text.setWrapStyleWord(true);
  JScrollPane scroll =
      new JScrollPane(
          text,
          JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
          JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scroll.setPreferredSize(new Dimension(400, 80));
  return scroll;
}

代码示例来源: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: 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: geotools/geotools

public JComponent doLayout() {
  if (parameter.metadata != null
      && parameter.metadata.get(Parameter.IS_PASSWORD) == Boolean.TRUE) {
    text = new JPasswordField(32);
  } else if (single) {
    text = new JTextField(32);
  } else {
    text = new JTextArea(40, 2);
    ((JTextArea) text).setWrapStyleWord(true);
  }
  text.addKeyListener(
      new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
          validate();
        }
      });
  if (text instanceof JTextArea) {
    JScrollPane scroll =
        new JScrollPane(
            text,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setPreferredSize(new Dimension(400, 80));
    return scroll;
  }
  return text;
}

代码示例来源: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: 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: 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,

代码示例来源: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: stanfordnlp/CoreNLP

inputBox.setLineWrap(true);
inputBox.setWrapStyleWord(true);
outputBox.setLineWrap(true);
outputBox.setWrapStyleWord(true);
outputBox.setEditable(false);
JScrollPane scroll1 = new JScrollPane(inputBox);
JScrollPane scroll2 = new JScrollPane(outputBox);
scroll1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Type a sentence to tag: "));
scroll2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Tagged sentence: "));
JPanel buttonPanel = new JPanel();
buttonPanel.setBackground(Color.WHITE);
buttonPanel.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

代码示例来源:origin: stackoverflow.com

import javax.swing.JTextArea;

public final class JWrappedLabel {
  private static final long serialVersionUID = -844167470113830283L;

  private final JTextArea textArea;

  public JWrappedLabel(final String text){
    textArea = new JTextArea(text);
    textArea.setOpaque(false);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
  }

  //add methods which delegate calls to the textArea
}

代码示例来源: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: 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() {
  popupText = new javax.swing.JTextArea();
  setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
  setLayout(new java.awt.BorderLayout());
  popupText.setBackground(new java.awt.Color(204, 204, 204));
  popupText.setColumns(20);
  popupText.setEditable(false);
  popupText.setLineWrap(true);
  popupText.setRows(1);
  popupText.setWrapStyleWord(true);
  popupText.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
  add(popupText, java.awt.BorderLayout.PAGE_START);
}// </editor-fold>//GEN-END:initComponents

代码示例来源:origin: FudanNLP/fnlp

void init(){		
  textIn=new JTextArea();
  textIn.setLineWrap(false);
  textIn.setWrapStyleWord(true);
  jspIn=new JScrollPane(textIn);
  textOut=new JTextArea();
  textOut.setLineWrap(false);
  textOut.setWrapStyleWord(true);
  textOut.setEditable(false);
  textOut.setText("");
  jspOut=new JScrollPane(textOut);
  jspOut.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

代码示例来源:origin: stackoverflow.com

JTextArea textArea = new JTextArea();
textArea.setColumns(10);
textArea.setRows(1);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);

相关文章

JTextArea类方法