javax.swing.text.JTextComponent.getCaretColor()方法的使用及代码示例

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

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

JTextComponent.getCaretColor介绍

暂无

代码示例

代码示例来源:origin: groovy/groovy-core

public void paint(Graphics g) {
  if (isVisible()) {
    try {
      JTextComponent component = getComponent();
      Rectangle r = component.getUI().modelToView(component, getDot());
      Color c = g.getColor();
      g.setColor(component.getBackground());
      g.setXORMode(component.getCaretColor());
      r.setBounds(r.x, r.y,
          g.getFontMetrics().charWidth('w'),
          g.getFontMetrics().getHeight());
      g.fillRect(r.x, r.y, r.width, r.height);
      g.setPaintMode();
      g.setColor(c);
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

Color c = editor.getCaretColor();
if (c==null) {
  editor.setCaretColor(RTextArea.getDefaultCaretColor());

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

private Color selectedColor() {
  if (backgroundColor.equals(backgroundColor())) {
    return selectedColor;
  }
  if (textComponent != null) {
    return textComponent.getCaretColor();
  }
  return selectedColor;
}

代码示例来源:origin: org.codehaus.groovy/groovy-console

public void paint(Graphics g) {
  if (isVisible()) {
    try {
      JTextComponent component = getComponent();
      Rectangle r = component.getUI().modelToView(component, getDot());
      Color c = g.getColor();
      g.setColor(component.getBackground());
      g.setXORMode(component.getCaretColor());
      r.setBounds(r.x, r.y,
          g.getFontMetrics().charWidth('w'),
          g.getFontMetrics().getHeight());
      g.fillRect(r.x, r.y, r.width, r.height);
      g.setPaintMode();
      g.setColor(c);
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

EditorUI editorUI = Utilities.getEditorUI(c);
if (THIN_LINE_CARET.equals(type)) { // thin line caret
  g.setColor(c.getCaretColor());
  int upperX = x;
  if (beforeCaretFont != null && beforeCaretFont.isItalic() && italic) {
  g.setColor(c.getCaretColor());
  if (afterCaretFont != null) g.setFont(afterCaretFont);
  if (afterCaretFont != null && afterCaretFont.isItalic() && italic) { // paint italic caret
  g.setColor(c.getCaretColor());
  int blkWidth = 2;
  if (beforeCaretFont != null && beforeCaretFont.isItalic() && italic) {

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public void paint(Graphics g) {
  if (isVisible()) {
    try {
      JTextComponent component = getComponent();
      Rectangle r =
          component.getUI().modelToView(component, getDot());
      Color c = g.getColor();
      g.setColor(component.getBackground());
      g.setXORMode(component.getCaretColor());
      r.setBounds(r.x, r.y,
          g.getFontMetrics().charWidth('w'),
          g.getFontMetrics().getHeight());
      g.fillRect(r.x, r.y, r.width, r.height);
      g.setPaintMode();
      g.setColor(c);
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public void paint(Graphics g) {
  if (isVisible()) {
    try {
      JTextComponent component = getComponent();
      Rectangle r =
        component.getUI().modelToView(component, getDot());
      Color c = g.getColor();
      g.setColor(component.getBackground());
      g.setXORMode(component.getCaretColor());
      r.setBounds(r.x, r.y,
            g.getFontMetrics().charWidth('w'),
            g.getFontMetrics().getHeight());
      g.fillRect(r.x, r.y, r.width, r.height);
      g.setPaintMode();
      g.setColor(c);
    }
    catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

g.setColor(comp.getCaretColor());

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public void paint(Graphics g) {
  if (isVisible()) {
    try {
      JTextComponent component = getComponent();
      Rectangle r =
        component.getUI().modelToView(component, getDot());
      Color c = g.getColor();
      g.setColor(component.getBackground());
      g.setXORMode(component.getCaretColor());
      r.setBounds(r.x, r.y,
            g.getFontMetrics().charWidth('w'),
            g.getFontMetrics().getHeight());
      g.fillRect(r.x, r.y, r.width, r.height);
      g.setPaintMode();
      g.setColor(c);
    }
    catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: org.kohsuke.droovy/groovy

public void paint(Graphics g) {
  if (isVisible()) {
    try {
      JTextComponent component = getComponent();
      Rectangle r =
        component.getUI().modelToView(component, getDot());
      Color c = g.getColor();
      g.setColor(component.getBackground());
      g.setXORMode(component.getCaretColor());
      r.setBounds(r.x, r.y,
            g.getFontMetrics().charWidth('w'),
            g.getFontMetrics().getHeight());
      g.fillRect(r.x, r.y, r.width, r.height);
      g.setPaintMode();
      g.setColor(c);
    }
    catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: net.java.abeille/abeille

EditorUI editorUI = Utilities.getEditorUI(c);
if (THIN_LINE_CARET.equals(type)) { // thin line caret
  g.setColor(c.getCaretColor());
  int upperX = x;
  if (beforeCaretFont != null && beforeCaretFont.isItalic() && italic) {
  g.setColor(c.getCaretColor());
  g.setFont(afterCaretFont);
  if (afterCaretFont.isItalic() && italic) { // paint italic
  g.setColor(c.getCaretColor());
  int blkWidth = 2;
  if (beforeCaretFont != null && beforeCaretFont.isItalic() && italic) {

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

int textHeight = fm.getHeight();
g.setColor(comp.getCaretColor());
g.drawString(mark, x, y + fm.getAscent());

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

g.setColor(getComponent().getCaretColor());
int paintWidth = 1;
r.x -= paintWidth >> 1;

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

Color c = editor.getCaretColor();
if (c==null) {
  editor.setCaretColor(RTextArea.getDefaultCaretColor());

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

Color c = editor.getCaretColor();
if (c==null) {
  editor.setCaretColor(RTextArea.getDefaultCaretColor());

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

Color c = editor.getCaretColor();
if (c==null) {
  editor.setCaretColor(RTextArea.getDefaultCaretColor());

代码示例来源:origin: khuxtable/seaglass

SeaGlassStyle style = (SeaGlassStyle) context.getStyle();
Color color = c.getCaretColor();

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
  editor.setCaretColor(plaf.getColor(prefix + ".caretForeground"));

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
  editor.setCaretColor(plaf.getColor(prefix + ".caretForeground"));

相关文章

JTextComponent类方法