当前位置: 首页>>代码示例>>Java>>正文


Java JTextArea.setLineWrap方法代码示例

本文整理汇总了Java中javax.swing.JTextArea.setLineWrap方法的典型用法代码示例。如果您正苦于以下问题:Java JTextArea.setLineWrap方法的具体用法?Java JTextArea.setLineWrap怎么用?Java JTextArea.setLineWrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTextArea的用法示例。


在下文中一共展示了JTextArea.setLineWrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ImagePicker

import javax.swing.JTextArea; //导入方法依赖的package包/类
public ImagePicker() {
  noImage = new JTextArea(1,10);
  noImage.setFont(FONT);
  noImage.setText("Double-click here to add new image");
  noImage.addMouseListener(this);
  noImage.setEditable(false);
  noImage.setLineWrap(true);
  noImage.setWrapStyleWord(true);
  noImage.setMinimumSize(new Dimension(15, 32));
  icon = new OpIcon();
  imageView = new JLabel(icon);
  imageView.addMouseListener(this);

  imageViewer = new JPanel(new BorderLayout());
  imageScroller = new ScrollPane(
    imageView,
    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  imageViewer.add(imageScroller, BorderLayout.CENTER);

  select = new JComboBox(ArrayUtils.prepend(GameModule.getGameModule().getDataArchive().getImageNames(), NO_IMAGE));
  select.addItemListener(this);
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  add(noImage);
  add(select);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:27,代码来源:ImagePicker.java

示例2: MessageTextArea

import javax.swing.JTextArea; //导入方法依赖的package包/类
public MessageTextArea(boolean editable, String text, String labelText) {
    setLayout(new BorderLayout());

    area = new JTextArea("");
    area.setSize(400, 400);
    area.setWrapStyleWord(true);
    area.setAutoscrolls(true);
    area.setLineWrap(true);
    area.setEditable(editable);
    area.setText(text);

    JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getViewport().add(area);
    scrollPane.setDoubleBuffered(true);
    add(scrollPane, "Center");

    JLabel message = new JLabel(labelText);
    add(message, "North");
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:21,代码来源:MessageWindow.java

示例3: ShowModifiedFilesDialog

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
* Private constructor
*/
private ShowModifiedFilesDialog() {
  setLayout(new GridBagLayout());
  modifiedFiles = new JTextArea(10, 40);
  modifiedFiles.setLineWrap(true);
  modifiedFiles.setWrapStyleWord(true);
  modifiedFiles.setEditable(false);

  JScrollPane scroll = new JScrollPane(modifiedFiles);
  scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 1;
  gbc.gridwidth = 1;
  gbc.gridheight = 1;
  gbc.weightx = 0;
  gbc.weighty = 0;
  gbc.fill = GridBagConstraints.BOTH;
  gbc.anchor = GridBagConstraints.LINE_START;
  add(scroll , gbc);
}
 
开发者ID:oxygenxml,项目名称:oxygen-dita-translation-package-builder,代码行数:25,代码来源:ShowModifiedFilesDialog.java

示例4: addCommitMessageTextArea

import javax.swing.JTextArea; //导入方法依赖的package包/类
private void addCommitMessageTextArea(GridBagConstraints gbc) {
	gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
			UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
	gbc.anchor = GridBagConstraints.WEST;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.gridx = 0;
	gbc.gridy = 2;
	gbc.weightx = 1;
	gbc.weighty = 1;
	gbc.gridwidth = 2;
	commitMessage = new JTextArea();
	commitMessage.setLineWrap(true);
	// Around 3 lines of text.
	int fontH = commitMessage.getFontMetrics(commitMessage.getFont()).getHeight();
	commitMessage.setWrapStyleWord(true);
	JScrollPane scrollPane = new JScrollPane(commitMessage);
	scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
	scrollPane.setMinimumSize(new Dimension(10, 3 * fontH));

	UndoSupportInstaller.installUndoManager(commitMessage);
	this.add(scrollPane, gbc);
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:23,代码来源:CommitPanel.java

示例5: jButton1ActionPerformed

import javax.swing.JTextArea; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    
    try {
        //JOptionPane pane = new JOptionPane();
        //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
        JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false);
        JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n");
        msg.setFont(new Font("monospaced", Font.PLAIN, 10));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        
        dialog.getContentPane().add(scrollPane);
        dialog.setSize(350, 350);
        //dialog.pack();
        dialog.setVisible(true);
        
        
    } catch (JSONException ex) {
        Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:ffleurey,项目名称:ThingML-Tradfri,代码行数:23,代码来源:BulbPanel.java

示例6: createDetailsSection

import javax.swing.JTextArea; //导入方法依赖的package包/类
private JComponent createDetailsSection()
{
	final JLabel notesLabel = new JLabel(getString("label.notes")); //$NON-NLS-1$

	notes = new JTextArea();
	notes.setWrapStyleWord(true);
	notes.setLineWrap(true);
	notes.setRows(3);
	notes.setBorder(new EmptyBorder(0, 0, 10, 0));

	final int height1 = notesLabel.getPreferredSize().height;
	final int height2 = notes.getPreferredSize().height;

	final int[] rows = {height1, height2};
	final int[] cols = {TableLayout.FILL};
	final JPanel all = new JPanel(new TableLayout(rows, cols));

	all.add(notesLabel, new Rectangle(0, 0, 1, 1));
	all.add(new JScrollPane(notes), new Rectangle(0, 1, 1, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:AdvancedScriptControlEditor.java

示例7: jButton2ActionPerformed

import javax.swing.JTextArea; //导入方法依赖的package包/类
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
    // TODO add your handling code here:
    int index = jtb_Comentarios.getSelectedRow();
    if(index > -1){
        JTextArea msg = new JTextArea(10, 20);
        msg.setText((String)jtb_Comentarios.getModel().getValueAt(index, 1));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        JOptionPane.showMessageDialog(this, scrollPane, (String)jtb_Comentarios.getModel().getValueAt(index, 0), JOptionPane.INFORMATION_MESSAGE);
    }
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:13,代码来源:TelaVisualizarComentariosUsuario.java

示例8: MetalworksDocumentFrame

import javax.swing.JTextArea; //导入方法依赖的package包/类
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:MetalworksDocumentFrame.java

示例9: TextAreaOutputStream

import javax.swing.JTextArea; //导入方法依赖的package包/类
public TextAreaOutputStream(JTextArea txtara, int maxlin) {
  if (maxlin < 1) {
    throw new IllegalArgumentException("TextAreaOutputStream maximum lines must be positive (value=" + maxlin + ")");
  }
  txtara.setEditable(false);
  txtara.setLineWrap(true);
  txtara.setWrapStyleWord(true);
  oneByte = new byte[1];
  appender = new Appender(txtara, maxlin);
}
 
开发者ID:juliango202,项目名称:jijimaku,代码行数:11,代码来源:TextAreaOutputStream.java

示例10: textarea

import javax.swing.JTextArea; //导入方法依赖的package包/类
/** Make a JTextArea with the given text and number of rows and columns, then call Util.make() to apply a set of attributes to it.
 * @param attributes - see {@link edu.mit.csail.sdg.alloy4.OurUtil#make OurUtil.make(component, attributes...)}
 */
public static JTextArea textarea (String text, int rows, int columns, boolean editable, boolean wrap, Object... attributes) {
   JTextArea ans = make(new JTextArea(text, rows, columns), Color.BLACK, Color.WHITE, new EmptyBorder(0,0,0,0));
   ans.setEditable(editable);
   ans.setLineWrap(wrap);
   ans.setWrapStyleWord(wrap);
   return make(ans, attributes);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:OurUtil.java

示例11: createTextArea

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * Creates a text area with standard settings suitable for use in FreeCol
 * panels, without setting its size.
 *
 * @param text The text to display in the text area.
 * @return A suitable text area.
 */
public static JTextArea createTextArea(String text) {
    JTextArea textArea = new JTextArea(text);
    textArea.setOpaque(false);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setFocusable(false);
    return textArea;
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:16,代码来源:Utility.java

示例12: Console

import javax.swing.JTextArea; //导入方法依赖的package包/类
public Console() {
	console = new JTextArea();
	clearButton = new JButton("Clear");
	//exportButton = new JButton("Export");
	setPanelTitle(PANEL_TITLE);

	clearButton.addActionListener(new ClearListener());
	//exportButton.addActionListener(new ExportListener());
	
	JPanel buttonsPanel = new JPanel();
	buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
	buttonsPanel.add(clearButton);
	//buttonsPanel.add(exportButton);
	
	console.setFont(new Font(CONSOLE_STYLE, Font.PLAIN, FONT_SIZE));
	//console.setRows(NROWS);
	console.setEditable(false);
	JScrollPane sp = new JScrollPane(console);
	sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
	sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	console.setSelectedTextColor(Color.GRAY);
	console.setLineWrap(true);
	console.setWrapStyleWord(true);
	
	// Automatic down scrolling
	DefaultCaret caret = (DefaultCaret) getConsole().getCaret();
	caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
	
	setLayout(new BorderLayout());
	
	add(buttonsPanel, BorderLayout.SOUTH);
	add(sp);
	
	LineBorder lineBorderPanel = (LineBorder) BorderFactory.createLineBorder(PANEL_BORDER_COLOR);
	setBorder(BorderFactory.createTitledBorder(lineBorderPanel, getPanelTitle()));
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:37,代码来源:Console.java

示例13: addInfo

import javax.swing.JTextArea; //导入方法依赖的package包/类
public JScrollPane addInfo(String info) {
    JTextArea jta = new JTextArea(info,8,20);
    jta.setEditable(false);
    jta.setLineWrap(true);
    JScrollPane sp = new JScrollPane(jta);
    return sp;

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:PrintManualTest_FitWidthMultiple.java

示例14: ShowGPL

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * The class constructor puts all graphics application's components.
 */
public ShowGPL() {
    super("DicomReader is under the GNU General Public License");
    
    // Main container
    Container c = getContentPane();
    c.setLayout(new BorderLayout(10, 10));
    
    // resultPanel resultArea
    JPanel resultPanel = new JPanel();
    resultPanel.setLayout(new BorderLayout(10, 10));
    
    resultArea = new JTextArea();
    resultArea.setLineWrap(true);
    resultArea.setWrapStyleWord(true);
    resultArea.setOpaque(false);
    resultArea.setEditable(false);
    
    //resultArea.setFont(new Font("Lucida Console", Font.PLAIN, 12));
    //resultArea.setFont(new JLabel().getFont());
    
    JScrollPane scrollPanel = new JScrollPane(resultArea);
    resultPanel.add(scrollPanel);
    
    c.add(resultPanel, BorderLayout.CENTER);
    
    // bottomPanel
    JPanel bottomPanel = new JPanel();
    JLabel bottomLabel = new JLabel(appName);
    bottomLabel.setEnabled(false);
    bottomPanel.add(bottomLabel);
    
    c.add(bottomPanel, BorderLayout.SOUTH);
    
    
}
 
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:39,代码来源:ShowGPL.java

示例15: getTextComponent

import javax.swing.JTextArea; //导入方法依赖的package包/类
@Override
protected JTextComponent getTextComponent()
{
	ta = new JTextArea();
	ta.setLineWrap(true);
	ta.setWrapStyleWord(true);
	return ta;
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:I18nTextArea.java


注:本文中的javax.swing.JTextArea.setLineWrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。