當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。