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


Java JTextArea.setFocusable方法代码示例

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


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

示例1: setMessage

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
* Define a descriptive message to be reported.  In the most common
* usage, the message is just a <code>String</code>.  However, the type
* of this parameter is actually <code>Object</code>.  Its interpretation depends on
* its type:
* <dl compact>
* <dt><code>Object[]</code><dd> A recursively interpreted series of messages.
* <dt>{@link Component}<dd> The <code>Component</code> is displayed in the dialog.
* <dt>{@link javax.swing.Icon}<dd> The <code>Icon</code> is wrapped in a {@link JLabel} and displayed in the dialog.
* <dt>anything else<dd> The {@link Object#toString string representation} of the object.
* </dl>
*
* @param newMessage the <code>Object</code> to report
* @see #getMessage
*/
public void setMessage(Object newMessage) {
    checkMessageValidity(newMessage);
    Object oldMessage = message;

    if (newMessage instanceof String) {
        // bugfix #25457, use JTextArea for word-wrapping
        JTextArea area = new JTextArea((String) newMessage);
        area.setPreferredSize(new Dimension(SIZE_PREFERRED_WIDTH, SIZE_PREFERRED_HEIGHT));
        area.setBackground(UIManager.getColor("Label.background")); // NOI18N
        area.setBorder(BorderFactory.createEmptyBorder());
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        area.setEditable(false);
        area.setFocusable(true);
        area.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NotifyDescriptor.class, "ACN_NotifyDescriptor_MessageJTextArea")); // NOI18N
        area.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NotifyDescriptor.class, "ACD_NotifyDescriptor_MessageJTextArea")); // NOI18N
        newMessage = area;
    }

    message = newMessage;
    firePropertyChange(PROP_MESSAGE, oldMessage, newMessage);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:NotifyDescriptor.java

示例2: createNiceMessages

import javax.swing.JTextArea; //导入方法依赖的package包/类
private JComponent createNiceMessages()
{
	JLabel heading = new JLabel("<html><font size=+1>" + title + "</font></html>");

	JTextArea body = new JTextArea(message);
	body.setHighlighter(null);
	body.setEditable(false);
	body.setFocusable(false);
	body.setOpaque(false);
	body.setBorder(null);
	body.setLineWrap(true);
	body.setWrapStyleWord(true);
	body.setFont(heading.getFont());

	final int[] rows = new int[]{heading.getPreferredSize().height, TableLayout.FILL};
	final int[] columns = new int[]{TableLayout.FILL};

	TableLayout layout = new TableLayout(rows, columns, 5, 5);
	JPanel all = new JPanel(layout);
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(heading, new Rectangle(0, 0, 1, 1));
	all.add(body, new Rectangle(0, 1, 1, 1));

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

示例3: ErrorPanel

import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
 * Creates an error panel containing the log file.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public ErrorPanel(FreeColClient freeColClient) {
    super(freeColClient, new MigLayout());

    String message = FreeColDirectories.getLogFileContents();
    if (message == null) message = Messages.message("errorPanel.loadError");

    JTextArea textArea = Utility.getDefaultTextArea(message, columnWidth);
    textArea.setFocusable(true);
    textArea.setEditable(false);
    
    JScrollPane scrollPane = new JScrollPane(textArea,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getViewport().setOpaque(false);

    add(scrollPane, "height 200:200:, wrap 20");
    add(okButton, "tag ok");
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:24,代码来源:ErrorPanel.java

示例4: 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:FreeCol,项目名称:freecol,代码行数:16,代码来源:Utility.java


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