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

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

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

JTextArea.setForeground介绍

暂无

代码示例

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

JTextArea area = new JTextArea("hello world");
area.setForeground(Color.red)

代码示例来源:origin: igniterealtime/Smack

adhocMessages.setForeground(new Color(1, 94, 35));
tabbedPane.add("Ad-hoc message", new JScrollPane(adhocMessages));
tabbedPane.setToolTipTextAt(3, "Panel that allows you to send adhoc packets");

代码示例来源:origin: igniterealtime/Smack

sentText1.setEditable(false);
sentText2.setEditable(false);
sentText1.setForeground(new Color(112, 3, 3));
sentText2.setForeground(new Color(112, 3, 3));
allPane.add(new JScrollPane(sentText1));
tabbedPane.add("Sent", new JScrollPane(sentText2));
receivedText1.setEditable(false);
receivedText2.setEditable(false);
receivedText1.setForeground(new Color(6, 76, 133));
receivedText2.setForeground(new Color(6, 76, 133));
allPane.add(new JScrollPane(receivedText1));
tabbedPane.add("Received", new JScrollPane(receivedText2));
interpretedText1.setForeground(new Color(1, 94, 35));
interpretedText2.setForeground(new Color(1, 94, 35));
allPane.add(new JScrollPane(interpretedText1));
tabbedPane.add("Interpreted", new JScrollPane(interpretedText2));

代码示例来源:origin: igniterealtime/Smack

sentText.setLineWrap(true);
sentText.setEditable(false);
sentText.setForeground(new Color(112, 3, 3));
tabbedPane.add("Raw Sent Packets", new JScrollPane(sentText));
tabbedPane.setToolTipTextAt(1, "Raw text of the sent packets");
receivedText.setLineWrap(true);
receivedText.setEditable(false);
receivedText.setForeground(new Color(6, 76, 133));
tabbedPane.add("Raw Received Packets", new JScrollPane(receivedText));
tabbedPane.setToolTipTextAt(

代码示例来源:origin: wildfly/wildfly

status.setForeground(Color.BLUE);

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

private void setForegroundColor(Color color) {
    if (numberLabel != null) {
      numberLabel.setForeground(color);
      numberLabel.setBackground(color);
    }
    ta.setForeground(color);
  }
}

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

JTextArea txt = new JTextArea();
Font font = new Font("Verdana", Font.BOLD, 12);
txt.setFont(font);
txt.setForeground(Color.BLUE);

代码示例来源:origin: geotools/geotools

public boolean validate() {
    WKTReader reader = new WKTReader();
    String wkt = text.getText();
    if (wkt.length() == 0) {
      return true;
    }

    try {
      Geometry geom = reader.read(wkt);
      if (parameter.type.isInstance(geom)) {
        text.setToolTipText(null);
        text.setForeground(Color.BLACK);
        return true;
      } else {
        text.setToolTipText("Could not use " + geom.getClass() + " as " + parameter.type);
        text.setForeground(Color.RED);
        return false;
      }
    } catch (Throwable eek) {
      text.setToolTipText(eek.getLocalizedMessage());
      text.setForeground(Color.RED);
      return false;
    }
  }
}

代码示例来源:origin: com.google.code.findbugs/findbugs

@Override
public void focusGained(FocusEvent e) {
  commentBox.setForeground(null);
  commentBox.setFont(plainCommentFont);
  if (isDefaultComment(commentBox.getText())) {
    resetCommentBoxFont();
    setCommentText("");
  }
}

代码示例来源:origin: Exslims/MercuryTrade

public JTextArea getSimpleTextArea(String text) {
  JTextArea area = new JTextArea(text);
  area.setEditable(false);
  area.setWrapStyleWord(true);
  area.setLineWrap(true);
  area.setBackground(AppThemeColor.TRANSPARENT);
  area.setBorder(null);
  area.setFont(REGULAR_FONT.deriveFont(scale * 16f));
  area.setForeground(AppThemeColor.TEXT_DEFAULT);
  return area;
}

代码示例来源:origin: protegeproject/protege

private void clearErrorMessage() {
  messageLabel.setText("");
  messageLabel.setForeground(null);
  annotationContent.setToolTipText(null);
  annotationContent.setForeground(null);
}

代码示例来源:origin: com.google.code.findbugs/findbugs

private void setDefaultComment(String defaultComment) {
  setCommentText(defaultComment);
  commentBox.setForeground(Color.DARK_GRAY);
  commentBox.setFont(plainCommentFont.deriveFont(Font.ITALIC));
}

代码示例来源:origin: undera/jmeter-plugins

private void reportError(String msg) {
  JTextArea infoArea = variablesCsvUi.getCheckInfoTextArea();
  infoArea.setText(infoArea.getText() + "Problem detected: " + msg + "\n");
  infoArea.setForeground(Color.red);
}

代码示例来源:origin: datacleaner/DataCleaner

@Override
  public void mouseExited(final MouseEvent e) {
    _bodyLabel.setForeground(COLOR_NORMAL);
    setBorder(_normalBorder);
  }
};

代码示例来源:origin: kg.apc/jmeter-plugins-extras

private void reportError(String msg) {
  JTextArea infoArea = variablesCsvUi.getCheckInfoTextArea();
  infoArea.setText(infoArea.getText() + "Problem detected: " + msg + "\n");
  infoArea.setForeground(Color.red);
}

代码示例来源:origin: com.diffplug.matsim/matconsolectl

private void displayException(Exception exc) {
    _returnPane.setBorder(BorderFactory.createTitledBorder(RETURNED_EXCEPTION));
    _returnArea.setForeground(Color.RED);
    _returnArea.setText(ReturnFormatter.formatException(exc));
    _returnArea.setCaretPosition(0);
  }
}

代码示例来源:origin: org.integratedmodelling/klab-common

/**
 * This is called when the input color is changed so that all input is added with the
 * AttributeSet (Style) that has been specified for input.
 */
private void setInputAttribute() {
  inputControl.setInputAttributeSet(consoleStyledDocument.getStyle(inputColor));
  if (!useInlineInput) {
    inputArea.setForeground(getStyleColorFromCode(inputColor.charAt(0))); // Foreground
    inputArea.setBackground(getStyleColorFromCode(inputColor.charAt(1))); // Background
  }
}

代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-core

private void doSetMessage(final IMessage message) {
 try {
  this.messageTitleLabel.setForeground(MessageUI.getColor(message));
  this.messageTitleLabel.setText(message.getText());
  this.messageTypeLabel.setIcon(MessageUI.getIcon(message, getIcon()));
  this.messageTextArea.setForeground(MessageUI.getColor(message));
  this.messageDocument.replace(0, this.messageDocument.getLength(), message.getDescription(), null);
 } catch (final Exception exception) {
  // TODO_NOW: handle exception
 }
}

代码示例来源:origin: mucommander/mucommander

private void setForegroundColors() {
  preview.setForeground(themeData.getColor(ThemeData.EDITOR_FOREGROUND_COLOR));
  preview.setCaretColor(themeData.getColor(ThemeData.EDITOR_FOREGROUND_COLOR));
  preview.setSelectedTextColor(themeData.getColor(ThemeData.EDITOR_SELECTED_FOREGROUND_COLOR));
}

代码示例来源:origin: mucommander/mucommander

private void setForegroundColors() {
  shellPreview.setForeground(themeData.getColor(ThemeData.SHELL_FOREGROUND_COLOR));
  shellPreview.setSelectedTextColor(themeData.getColor(ThemeData.SHELL_SELECTED_FOREGROUND_COLOR));
  shellPreview.setCaretColor(themeData.getColor(ThemeData.SHELL_FOREGROUND_COLOR));
  historyPreview.setForeground(themeData.getColor(ThemeData.SHELL_HISTORY_FOREGROUND_COLOR));
  historyPreview.setSelectionForeground(themeData.getColor(ThemeData.SHELL_HISTORY_SELECTED_FOREGROUND_COLOR));
}

相关文章

JTextArea类方法