javax.swing.JTextPane.setCaretColor()方法的使用及代码示例

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

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

JTextPane.setCaretColor介绍

暂无

代码示例

代码示例来源:origin: beryx/text-io

public void setInputColor(String colorName) {
  getColor(colorName).ifPresent(col -> {
    inputStyleData.color = col;
    textPane.setCaretColor(inputStyleData.color);
  });
}

代码示例来源:origin: apache/ctakes

private JComponent createEastPanel() {
 _piperDocument = new DefaultStyledDocument();
 _piperTextFilter = new PiperTextFilter( _piperDocument );
 _textPane = new JTextPane( _piperDocument );
 _textPane.putClientProperty( "caretWidth", 2 );
 _textPane.setCaretColor( Color.MAGENTA );
 final JScrollPane scroll = new JScrollPane( _textPane );
 final TextLineNumber lineNumber = new TextLineNumber( _textPane, 2 );
 scroll.setRowHeaderView( lineNumber );
 scroll.setMinimumSize( new Dimension( 100, 10 ) );
 return scroll;
}

代码示例来源:origin: apache/ctakes

private JComponent createEastPanel() {
 _piperDocument = new DefaultStyledDocument();
 _piperTextFilter = new PiperTextFilter( _piperDocument );
 _textPane = new JTextPane( _piperDocument );
 _textPane.putClientProperty( "caretWidth", 2 );
 _textPane.setCaretColor( Color.MAGENTA );
 _textPane.setEditable( false );
 final JScrollPane scroll = new JScrollPane( _textPane );
 final TextLineNumber lineNumber = new TextLineNumber( _textPane, 2 );
 scroll.setRowHeaderView( lineNumber );
 scroll.setMinimumSize( new Dimension( 100, 10 ) );
 return scroll;
}

代码示例来源:origin: otros-systems/otroslogviewer

loggerConfigTextPane.setCaretColor(loggerConfigTextPane.getForeground());
loggerConfigTextPane.setCaret(new DefaultCaret());
loggerConfigTextPane.getDocument().addDocumentListener(new DocumentChangeListener(this::updatePatterns));

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

public ConsoleFacade(String bannerText) {
  textPane = new JTextPane();
textPane.setMargin(new Insets(4, 4, 0, 4));
  textPane.setCaretColor(new Color(0xa4, 0x00, 0x00));
  textPane.setBackground(new Color(0xf2, 0xf2, 0xf2));
  textPane.setForeground(new Color(0xa4, 0x00, 0x00));
  Font font = findFont("Monospaced", Font.PLAIN, 14,
             new String[] {"Monaco", "Andale Mono"});
  textPane.setFont(font);
  scrollPane = new JScrollPane(textPane);
  scrollPane.setDoubleBuffered(true);
  if ( bannerText != null ) {
    bannerText = "  " + bannerText + "  \n\n";
  }
  adaptor = new TextAreaReadline(textPane, bannerText);
  inputStream = adaptor.getInputStream();
  outputStream = new PrintStream(adaptor.getOutputStream());
  errorStream = new PrintStream(adaptor.getOutputStream());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

text.setCaretColor(new Color(0xa4, 0x00, 0x00));
text.setBackground(new Color(0xf2, 0xf2, 0xf2));
text.setForeground(new Color(0xa4, 0x00, 0x00));

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

consolePane.setCaretColor(defaultCaret);
consolePane.setFont(consoleFont);
consolePane.setBorder(null);

代码示例来源:origin: bbuck/DragonConsole

consolePane.setCaretColor(defaultCaret);
consolePane.setFont(consoleFont);
consolePane.setBorder(null);

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

_outputPanel.setParagraphAttributes( sas, false );
_outputPanel.setEditable( false );
_outputPanel.setCaretColor( Color.white );

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

/** 
 * Creates new form QueryInterfacePanel
 */
public QueryInterfacePanel(OBDAModel apic, QueryController qc) {
  this.qc = qc;
  this.apic = apic;
  
  initComponents();
  StyleContext style = new StyleContext();
  styledDocument = new DefaultStyledDocument(style);
  queryTextPane.setDocument(styledDocument);
  queryTextPane.setBackground(Color.WHITE);
  queryTextPane.setCaretColor(Color.BLACK);
  queryTextPane.addKeyListener(new CTRLEnterKeyListener());
}

代码示例来源:origin: bbuck/DragonConsole

/** 
 * Sets the default styles so the console colors mimic that of a standard
 * Gray on Black color setting. Sets the default colors for defaultColor,
 * systemColor, and errorColor.
 */
public void setDefaultStyle() {
  consolePane.setBackground(defaultBackground);
  consolePane.setCaretColor(defaultCaret);
  consolePane.setForeground(defaultForeground);
  inputArea.setBackground(defaultBackground);
  inputArea.setCaretColor(defaultCaret);
  inputArea.setForeground(defaultForeground);
  consolePrompt.setPromptForeground(defaultForeground);
  consolePrompt.setBackground(defaultBackground);
  defaultColor = "xb";
  systemColor = "cb";
  errorColor = "rb";
  inputColor = "xb";
  setInputAttribute();
  if (!useInlineInput)
    consolePrompt.setDefaultColor(defaultColor);
  clearConsole();
  printDefault();
}

代码示例来源:origin: bbuck/DragonConsole

/** 
 * Set the background to White and the foreground text to Black to mimic
 * the default color settings of a Mac Terminal.
 * Also changes the defaultColor, systemColor, and errorColor codes so
 * that they take into account the new background/foreground colors.
 */
public void setMacStyle() {
  consolePane.setBackground(defaultMacBackground);
  consolePane.setCaretColor(defaultMacCaret);
  consolePane.setForeground(defaultMacForeground);
  inputArea.setBackground(defaultMacBackground);
  inputArea.setCaretColor(defaultMacCaret);
  inputArea.setForeground(defaultMacForeground);
  consolePrompt.setPromptForeground(defaultMacForeground);
  consolePrompt.setBackground(defaultMacBackground);
  defaultColor = "bw";
  systemColor = "ow";
  errorColor = "rw";
  inputColor = "bw";
  setInputAttribute();
  if (!useInlineInput)
    consolePrompt.setDefaultColor(defaultColor);
  clearConsole();
  printDefault();
}

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

/**
 * Sets the default styles so the console colors mimic that of a standard Gray on
 * Black color setting. Sets the default colors for defaultColor, systemColor, and
 * errorColor.
 */
public void setDefaultStyle() {
  consolePane.setBackground(defaultBackground);
  consolePane.setCaretColor(defaultCaret);
  consolePane.setForeground(defaultForeground);
  inputArea.setBackground(defaultBackground);
  inputArea.setCaretColor(defaultCaret);
  inputArea.setForeground(defaultForeground);
  consolePrompt.setPromptForeground(defaultForeground);
  consolePrompt.setBackground(defaultBackground);
  defaultColor = "xb";
  systemColor = "cb";
  errorColor = "rb";
  inputColor = "xb";
  setInputAttribute();
  if (!useInlineInput)
    consolePrompt.setDefaultColor(defaultColor);
  clearConsole();
  printDefault();
}

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

/**
 * Set the background to White and the foreground text to Black to mimic the default
 * color settings of a Mac Terminal. Also changes the defaultColor, systemColor, and
 * errorColor codes so that they take into account the new background/foreground
 * colors.
 */
public void setMacStyle() {
  consolePane.setBackground(defaultMacBackground);
  consolePane.setCaretColor(defaultMacCaret);
  consolePane.setForeground(defaultMacForeground);
  inputArea.setBackground(defaultMacBackground);
  inputArea.setCaretColor(defaultMacCaret);
  inputArea.setForeground(defaultMacForeground);
  consolePrompt.setPromptForeground(defaultMacForeground);
  consolePrompt.setBackground(defaultMacBackground);
  defaultColor = "bw";
  systemColor = "ow";
  errorColor = "rw";
  inputColor = "bw";
  setInputAttribute();
  if (!useInlineInput)
    consolePrompt.setDefaultColor(defaultColor);
  clearConsole();
  printDefault();
}

代码示例来源:origin: beryx/text-io

promptStyleData.color = DEFAULT_PROMPT_COLOR;
inputStyleData.color = DEFAULT_INPUT_COLOR;
textPane.setCaretColor(inputStyleData.color);

相关文章

JTextPane类方法