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


Java JTextArea.setColumns方法代码示例

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


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

示例1: createAndShowGUI

import javax.swing.JTextArea; //导入方法依赖的package包/类
private static void createAndShowGUI() {
    frame = new JFrame();
    final JScrollPane jScrollPane1 = new JScrollPane();
    ta = new JTextArea();

    ta.setEditable(false);
    ta.setColumns(20);
    ta.setRows(5);
    jScrollPane1.setViewportView(ta);
    frame.add(ta);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:TextViewOOM.java

示例2: createTextArea

import javax.swing.JTextArea; //导入方法依赖的package包/类
public static JTextArea createTextArea(int columns, String message) {
    JTextArea text = new JTextArea(message);
    text.setBackground(null);
    text.setEditable(false);
    text.setColumns(columns);
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    return text;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:UI.java

示例3: createMultilineLabel

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * Creates a text component to be used as a multi-line, automatically
 * wrapping label.
 * <p>
 * <strong>Restriction:</strong><br>
 * The component may have its preferred size very wide.
 *
 * @param  text  text of the label
 * @param  color  desired color of the label,
 *                or {@code null} if the default color should be used
 * @return  created multi-line text component
 */
public static JTextComponent createMultilineLabel(String text, Color color) {
    JTextArea textArea = new JTextArea(text);
    textArea.setEditable(false);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setEnabled(false);
    textArea.setOpaque(false);
    textArea.setColumns(25);
    textArea.setDisabledTextColor((color != null)
                                  ? color
                                  : new JLabel().getForeground());
    
    return textArea;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:GuiUtils.java

示例4: getCustomEditor

import javax.swing.JTextArea; //导入方法依赖的package包/类
@Override
public Component getCustomEditor () {
    if (customEditor == null) {
        JTextArea textArea = new JTextArea();
        textArea.setWrapStyleWord(true);
        textArea.setLineWrap(true);
        textArea.setColumns(60);
        textArea.setRows(8);
        textArea.getDocument().addDocumentListener(this);
        textArea.getAccessibleContext().setAccessibleName(
                NbBundle.getBundle(StringEditor.class).getString("ACSN_StringEditorTextArea")); //NOI18N
        textArea.getAccessibleContext().setAccessibleDescription(
                NbBundle.getBundle(StringEditor.class).getString("ACSD_StringEditorTextArea")); //NOI18N

        JScrollPane scroll = new JScrollPane();
        scroll.setViewportView(textArea);

        JLabel htmlTipLabel = new JLabel(NbBundle.getMessage(StringEditor.class, "StringEditor.htmlTipLabel.text")); // NOI18N

        JPanel panel = new JPanel();
        GroupLayout layout = new GroupLayout(panel);
        layout.setAutoCreateGaps(true);
        panel.setLayout(layout);
        layout.setHorizontalGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup()
                    .addComponent(scroll)
                    .addComponent(htmlTipLabel))
                .addContainerGap());
        layout.setVerticalGroup(layout.createSequentialGroup()
                .addContainerGap().addComponent(scroll).addComponent(htmlTipLabel));

        customEditor = panel;
        textComp = textArea;
        htmlTipLabel.setVisible(htmlText);
    }

    textComp.setEditable(editable);
    setValueToCustomEditor();

    return customEditor;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:StringEditor.java

示例5: problemPanel

import javax.swing.JTextArea; //导入方法依赖的package包/类
private static JPanel problemPanel(String header, String message) {
    JPanel panel = new JPanel();
    JLabel jLabel1 = new javax.swing.JLabel();
    JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
    JTextArea jTextArea1 = new javax.swing.JTextArea();

    jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
    jLabel1.setText(header);

    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setLineWrap(true);
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setRows(5);
    jTextArea1.setText(message);
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(panel);
    panel.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addGap(107, 107, 107)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jLabel1)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
            .addGap(82, 82, 82))
    );
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:ModuleInstallerSupport.java

示例6: problemPanel

import javax.swing.JTextArea; //导入方法依赖的package包/类
private static JPanel problemPanel(String header, String message) {
    JPanel panel = new JPanel();
    JLabel jLabel1 = new javax.swing.JLabel();
    JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
    JTextArea jTextArea1 = new javax.swing.JTextArea();

    jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
    jLabel1.setText(header);

    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setLineWrap(true);
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setRows(5);
    jTextArea1.setText(message);
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);

    javax.swing.GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addGap(107, 107, 107)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jLabel1)
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
            .addGap(82, 82, 82))
    );
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:SwingAppLibDownloader.java

示例7: layoutSelectResourcePanel

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * @author  Marian Petras
 */
static void layoutSelectResourcePanel(final Container thePanel,
                                      final String instructionsText,
                                      final String selectionLabelText,
                                      final Component selectionComp,
                                      final JButton button1,
                                      final JButton button2) {
    JTextArea instructions = new JTextArea();
    JLabel lblSelection = new JLabel();

    instructions.setColumns(20);
    instructions.setEditable(false);
    instructions.setLineWrap(true);
    instructions.setText(instructionsText);
    instructions.setWrapStyleWord(true);
    instructions.setDisabledTextColor(new JLabel().getForeground());
    instructions.setEnabled(false);
    instructions.setOpaque(false);

    lblSelection.setLabelFor(selectionComp);
    Mnemonics.setLocalizedText(lblSelection, selectionLabelText);

    JScrollPane scrollPane = new JScrollPane(selectionComp);

    Container filesSelection = new JPanel();
    GroupLayout layout = new GroupLayout(filesSelection);
    filesSelection.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(LEADING)
        .addComponent(lblSelection)
        .addGroup(layout.createSequentialGroup()
            .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE)
            .addPreferredGap(RELATED)
            .addGroup(layout.createParallelGroup(LEADING)
                .addComponent(button1)
                .addComponent(button2)))
    );

    layout.linkSize(SwingConstants.HORIZONTAL, button1, button2);

    layout.setVerticalGroup(
        layout.createParallelGroup(LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(lblSelection)
            .addPreferredGap(RELATED)
            .addGroup(layout.createParallelGroup(LEADING)
                .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(button1)
                    .addPreferredGap(RELATED)
                    .addComponent(button2))))
    );

    LayoutStyle layoutStyle = layout.getLayoutStyle();
    if (layoutStyle == null) {
        layoutStyle = LayoutStyle.getInstance();
    }

    BorderLayout mainLayout = new BorderLayout();
    thePanel.setLayout(mainLayout);
    thePanel.add(instructions, BorderLayout.PAGE_START);
    thePanel.add(filesSelection, BorderLayout.CENTER);
    mainLayout.setVgap(layoutStyle.getPreferredGap(instructions,
                                                   lblSelection,
                                                   UNRELATED,
                                                   SwingConstants.NORTH,
                                                   thePanel));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:71,代码来源:Util.java

示例8: initComponents

import javax.swing.JTextArea; //导入方法依赖的package包/类
private void initComponents() {
	Box mainBox = Box.createVerticalBox();
	Box centralBox = Box.createHorizontalBox();
	// Pannello dei componenti univariate statistics panel
	JPanel componentsPanel = new JPanel(new BorderLayout(0, 5));

	setLayout(new GridLayout(1, 1));

	mainBox.add(Box.createVerticalStrut(10));
	mainBox.add(centralBox);
	mainBox.add(Box.createVerticalStrut(10));
	add(mainBox);

	// components univariate statistics panel
	if (distribution == EXPO) {
		componentsPanel.add(new JLabel("Results of fitting of exponential distribution"), BorderLayout.NORTH);
	} else {
		componentsPanel.add(new JLabel("Results of fitting of Pareto distribution"), BorderLayout.NORTH);
	}

	resultfittingScrollPane = new JScrollPane();
	resultfittingTextArea = new JTextArea();
	resultfittingTextArea.setColumns(20);
	resultfittingTextArea.setRows(5);
	resultfittingScrollPane.setViewportView(resultfittingTextArea);

	componentsPanel.add(resultfittingScrollPane, BorderLayout.CENTER);

	graphicspanel = new JPanel(new GridLayout(1,3));
	graphicspanel.setSize(new Dimension(200,100));

	panelqqplot = new JPanel(new BorderLayout());
	panelqqplot.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "QQ-plot"));

	panelcdf = new JPanel(new BorderLayout());
	panelcdf.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "CDF"));

	panelpdf = new JPanel(new BorderLayout());
	panelpdf.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "pdf"));

	qqplot = new SmallQQPlot(model,engfitting);
	qqplot.setDistribution(distribution); 
	cdfplot = new SmallCDF(model, engfitting);
	cdfplot.setDistribution(distribution);
	pdfplot = new SmallPDF(model, engfitting);
	//just to try
	panelqqplot.add(qqplot);
	panelcdf.add(cdfplot);
	panelpdf.add(pdfplot);

	graphicspanel.add(panelqqplot);
	graphicspanel.add(panelcdf);
	graphicspanel.add(panelpdf);
	graphicspanel.setPreferredSize(new Dimension(300,240));

	componentsPanel.add(graphicspanel, BorderLayout.SOUTH);
	centralBox.add(componentsPanel);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:59,代码来源:FittingPanel.java

示例9: initComponents

import javax.swing.JTextArea; //导入方法依赖的package包/类
private void initComponents() {
  	Box mainBox = Box.createVerticalBox();
Box centralBox = Box.createHorizontalBox();
// Pannello dei componenti univariate statistics panel
JPanel componentsPanel = new JPanel(new BorderLayout(0, 5));

setLayout(new GridLayout(1, 1));

mainBox.add(Box.createVerticalStrut(10));
mainBox.add(centralBox);
mainBox.add(Box.createVerticalStrut(10));
add(mainBox);

// Pannello dei componenti univariate statistics panel
if(distribution == EXPO)
	componentsPanel.add(new JLabel("Results of fitting of exponential distribution"), BorderLayout.NORTH);
else if(distribution == PARETO)
	componentsPanel.add(new JLabel("Results of fitting of Pareto distribution"), BorderLayout.NORTH);

      resultfittingScrollPane = new JScrollPane();
      resultfittingTextArea = new JTextArea();
      resultfittingTextArea.setColumns(20);
      resultfittingTextArea.setRows(5);
      resultfittingScrollPane.setViewportView(resultfittingTextArea);

      componentsPanel.add(resultfittingScrollPane, BorderLayout.CENTER);
      
      graphicspanel = new JPanel(new GridLayout(1,3));
      graphicspanel.setSize(new Dimension(200,100));
      
      panelqqplot = new JPanel(new BorderLayout());
      panelqqplot.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "QQ-plot"));
      
      panelcdf = new JPanel(new BorderLayout());
      panelcdf.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "CDF"));
      
      panelpdf = new JPanel(new BorderLayout());
      panelpdf.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "pdf"));

      qqplot = new SmallQQPlot(model,engfitting);
      qqplot.setDistribution(distribution); 
      cdfplot = new SmallCDF(model, engfitting);
      cdfplot.setDistribution(distribution);
      pdfplot = new SmallPDF(model, engfitting);
      //just to try
      panelqqplot.add(qqplot);
      panelcdf.add(cdfplot);
      panelpdf.add(pdfplot);

      graphicspanel.add(panelqqplot);
      graphicspanel.add(panelcdf);
      graphicspanel.add(panelpdf);
      graphicspanel.setPreferredSize(new Dimension(300,240));
      
      componentsPanel.add(graphicspanel, BorderLayout.SOUTH);
      centralBox.add(componentsPanel);
  }
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:58,代码来源:FittingPanel.java

示例10: FirstContactDialog

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * Create an FirstContactDialog.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param player The {@code Player} making contact.
 * @param other The {@code Player} to contact.
 * @param tile An optional {@code Tile} on offer.
 * @param settlementCount The number of settlements the other
 *     player has.
 */
public FirstContactDialog(FreeColClient freeColClient, JFrame frame,
        Player player, Player other, Tile tile, int settlementCount) {
    super(freeColClient, frame);

    MigPanel panel
        = new MigPanel(new MigLayout("wrap 1", "[center]", "[]20"));
    panel.setOpaque(false);

    String headerKey = BASE_KEY + other.getNation().getSuffix();
    String imageKey = IMAGE_BASE_KEY + other.getNationResourceKey();
    if (!Messages.containsKey(headerKey)) {
        headerKey = BASE_KEY + NATIVES_KEY;
        imageKey = IMAGE_BASE_KEY + NATIVES_KEY;
    }
    JLabel header = Utility.localizedHeaderLabel(headerKey,
        SwingConstants.LEADING, FontLibrary.FontSize.MEDIUM);
    JLabel image
        = new JLabel(new ImageIcon(ResourceManager.getImage(imageKey)));
    image.setOpaque(false);

    JTextArea tutorial = null;
    if (!player.hasContactedIndians() && freeColClient.tutorialMode()) {
        tutorial = Utility.localizedTextArea(TUTORIAL_KEY);
    }

    String messageId = (tile != null)
        ? "firstContactDialog.welcomeOffer.text"
        : "firstContactDialog.welcomeSimple.text";
    String type = ((IndianNationType)other.getNationType())
        .getSettlementTypeKey(true);
    JTextArea text = Utility.localizedTextArea(StringTemplate
        .template(messageId)
        .addStringTemplate("%nation%", other.getNationLabel())
        .addName("%camps%", Integer.toString(settlementCount))
        .add("%settlementType%", type));

    // Resize the text areas to better match the image.
    int columns = (int)Math.floor(text.getColumns()
        * image.getPreferredSize().getWidth()
        / text.getPreferredSize().getWidth());
    text.setColumns(columns);
    text.setSize(text.getPreferredSize());
    if (tutorial != null) {
        tutorial.setColumns(columns);
        tutorial.setSize(tutorial.getPreferredSize());
    }

    panel.add(header);
    panel.add(image);
    if (tutorial != null) panel.add(tutorial);
    panel.add(text);
    panel.setSize(panel.getPreferredSize());

    ImageIcon icon = new ImageIcon(
        getImageLibrary().getMiscIconImage(other.getNation()));
    initializeConfirmDialog(frame, false, panel, icon, "yes", "no");
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:69,代码来源:FirstContactDialog.java

示例11: getDefaultTextArea

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * Gets a text area with standard settings suitable for use in FreeCol
 * panels, which adapt their size based on what they contain.
 *
 * @param text The text to display in the text area.
 * @param columns The em-width number of columns to display the text in.
 * @return A suitable text area.
 */
public static JTextArea getDefaultTextArea(String text, int columns) {
    JTextArea textArea = createTextArea(text);
    textArea.setColumns(columns);
    textArea.setSize(textArea.getPreferredSize());
    return textArea;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:15,代码来源:Utility.java


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