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

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

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

JTextArea.setSelectedTextColor介绍

暂无

代码示例

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

/**
 * Set selection.
 */
public void select() {
  pModel.findSelectionPositions();
  editor.setSelectedTextColor(Color.blue);
  editor.requestFocusInWindow();
  editor.setCaretPosition(pModel.getSelectionStart());
  editor.moveCaretPosition(pModel.getSelectionEnd());
}

代码示例来源:origin: us.ihmc/simulation-construction-set-tools

protected YoGUIMessagePanel(String name)
{
 this.name = name;
 this.setLayout(new BorderLayout());
 textArea = new JTextArea();
 textArea.setLineWrap(true);
 // textArea.setColumns(WIDTH);
 // textArea.setRows(44);
 textArea.setSelectedTextColor(Color.WHITE);
 jScrollPane = new JScrollPane();
 jScrollPane.getViewport().add(textArea);
 textArea.setEditable(false);
 textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
 jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
 this.add(jScrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: us.ihmc/IHMCJavaToolkit

public GUIMessagePanel(String name)
{
 this.name = name;
 this.setLayout(new BorderLayout());
 textArea = new JTextArea();
 textArea.setLineWrap(true);
 // textArea.setColumns(WIDTH);
 // textArea.setRows(44);
 textArea.setSelectedTextColor(Color.WHITE);
 jScrollPane = new JScrollPane();
 jScrollPane.getViewport().add(textArea);
 textArea.setEditable(false);
 textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
 jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
 this.add(jScrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: us.ihmc/ihmc-java-toolkit

public GUIMessagePanel(String name)
{
 this.name = name;
 this.setLayout(new BorderLayout());
 textArea = new JTextArea();
 textArea.setLineWrap(true);
 // textArea.setColumns(WIDTH);
 // textArea.setRows(44);
 textArea.setSelectedTextColor(Color.WHITE);
 jScrollPane = new JScrollPane();
 jScrollPane.getViewport().add(textArea);
 textArea.setEditable(false);
 textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
 jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
 this.add(jScrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

public ErrorPanel(ISession session, ErrorPanelListener errorPanelListener, ArrayList<String> sqlExecErrorMsgs, String lastExecutedStatement)
{
 super(new BorderLayout());
 _errorPanelListener = errorPanelListener;
 _txtArea = new JTextArea();
 _txtArea.setFont(_txtArea.getFont().deriveFont(Font.BOLD));
 _txtArea.setForeground(Color.red);
 _txtArea.setSelectedTextColor(Color.red);
 _txtArea.setEditable(false);
 for (int i = 0; i < sqlExecErrorMsgs.size(); i++)
 {
   _txtArea.append(sqlExecErrorMsgs.get(i));
   if(i < sqlExecErrorMsgs.size() - 1)
   {
    _txtArea.append("\n\n");
   }
 }
 JScrollPane scrp = new JScrollPane(_txtArea);
 add(createNorthPanel(session, sqlExecErrorMsgs, lastExecutedStatement), BorderLayout.NORTH);
 add(scrp, BorderLayout.CENTER);
 initPopup();
 scrp.scrollRectToVisible(new Rectangle(0,0,1,1));
}

代码示例来源:origin: realXuJiang/bigtable-sql

public ErrorPanel(ISession session, ErrorPanelListener errorPanelListener, ArrayList<String> sqlExecErrorMsgs, String lastExecutedStatement)
{
 super(new BorderLayout());
 _errorPanelListener = errorPanelListener;
 _txtArea = new JTextArea();
 _txtArea.setFont(_txtArea.getFont().deriveFont(Font.BOLD));
 _txtArea.setForeground(Color.red);
 _txtArea.setSelectedTextColor(Color.red);
 _txtArea.setEditable(false);
 for (int i = 0; i < sqlExecErrorMsgs.size(); i++)
 {
   _txtArea.append(sqlExecErrorMsgs.get(i));
   if(i < sqlExecErrorMsgs.size() - 1)
   {
    _txtArea.append("\n\n");
   }
 }
 JScrollPane scrp = new JScrollPane(_txtArea);
 add(createNorthPanel(session, sqlExecErrorMsgs, lastExecutedStatement), BorderLayout.NORTH);
 add(scrp, BorderLayout.CENTER);
 initPopup();
 scrp.scrollRectToVisible(new Rectangle(0,0,1,1));
}

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

/**
 * Creates the panel in which the license text is displayed.
 * @return the panel in which the license text is displayed.
 */
private JScrollPane createLicensePanel() {
  JTextArea license;
  license = new JTextArea();
  license.setEditable(false);
  // Applies the file editor's theme to the license text.
  license.setForeground(ThemeManager.getCurrentColor(Theme.EDITOR_FOREGROUND_COLOR));
  license.setBackground(ThemeManager.getCurrentColor(Theme.EDITOR_BACKGROUND_COLOR));
  license.setSelectedTextColor(ThemeManager.getCurrentColor(Theme.EDITOR_SELECTED_FOREGROUND_COLOR));
  license.setSelectionColor(ThemeManager.getCurrentColor(Theme.EDITOR_SELECTED_BACKGROUND_COLOR));
  license.setFont(ThemeManager.getCurrentFont(Theme.EDITOR_FONT));
  license.setText(getLicenseText());
  // Sets the scroll policy and preferred dimensions.
  licensePanel = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  licensePanel.getViewport().setPreferredSize(new Dimension((int)license.getPreferredSize().getWidth(), 400));
  return licensePanel;
}

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

/**
 * Creates the dialog's shell output area.
 * @return a scroll pane containing the dialog's shell output area.
 */
private JScrollPane createOutputArea() {
  // Creates and initialises the output area.
  outputTextArea = new JTextArea();
  outputTextArea.setLineWrap(true);
  outputTextArea.setCaretPosition(0);
  outputTextArea.setRows(10);
  outputTextArea.setEditable(false);
  outputTextArea.addKeyListener(this);
  // Applies the current theme to the shell output area.
  outputTextArea.setForeground(ThemeManager.getCurrentColor(Theme.SHELL_FOREGROUND_COLOR));
  outputTextArea.setCaretColor(ThemeManager.getCurrentColor(Theme.SHELL_FOREGROUND_COLOR));
  outputTextArea.setBackground(ThemeManager.getCurrentColor(Theme.SHELL_BACKGROUND_COLOR));
  outputTextArea.setSelectedTextColor(ThemeManager.getCurrentColor(Theme.SHELL_SELECTED_FOREGROUND_COLOR));
  outputTextArea.setSelectionColor(ThemeManager.getCurrentColor(Theme.SHELL_SELECTED_BACKGROUND_COLOR));
  outputTextArea.setFont(ThemeManager.getCurrentFont(Theme.SHELL_FONT));
  // Creates a scroll pane on the shell output area.
  return new JScrollPane(outputTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}

代码示例来源:origin: com.puppycrawl.tools/checkstyle

/**
 * Set selection.
 */
public void select() {
  pModel.findSelectionPositions();
  editor.setSelectedTextColor(Color.blue);
  editor.requestFocusInWindow();
  editor.setCaretPosition(pModel.getSelectionStart());
  editor.moveCaretPosition(pModel.getSelectionEnd());
}

代码示例来源: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

/**
 * Receives theme color changes notifications.
 */
public void colorChanged(ColorChangedEvent event) {
  switch(event.getColorId()) {
  case Theme.EDITOR_FOREGROUND_COLOR:
    textArea.setForeground(event.getColor());
    break;
  case Theme.EDITOR_BACKGROUND_COLOR:
    textArea.setBackground(event.getColor());
    break;
  case Theme.EDITOR_SELECTED_FOREGROUND_COLOR:
    textArea.setSelectedTextColor(event.getColor());
    break;
  case Theme.EDITOR_SELECTED_BACKGROUND_COLOR:
    textArea.setSelectionColor(event.getColor());
    break;
  }
}

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

textArea.setCaretColor(ThemeManager.getCurrentColor(Theme.EDITOR_FOREGROUND_COLOR));
textArea.setBackground(ThemeManager.getCurrentColor(Theme.EDITOR_BACKGROUND_COLOR));
textArea.setSelectedTextColor(ThemeManager.getCurrentColor(Theme.EDITOR_SELECTED_FOREGROUND_COLOR));
textArea.setSelectionColor(ThemeManager.getCurrentColor(Theme.EDITOR_SELECTED_BACKGROUND_COLOR));
textArea.setFont(ThemeManager.getCurrentFont(Theme.EDITOR_FONT));

代码示例来源: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类方法