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

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

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

JTextComponent.getSelectionColor介绍

暂无

代码示例

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

Paint paint = getPaint();
if (paint==null) {
  g2d.setColor(c.getSelectionColor());

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

g2d.setColor(c.getSelectionColor());

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

/** Returns the text editor's highlight color.
 */
protected Color getHighlightColor()
{
  JTextComponent textComp = (JTextComponent)fContainer;
  return textComp.getSelectionColor();
}

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

c = editor.getSelectionColor();
if (c==null) {
  c = UIManager.getColor("nimbusSelectionBackground");

代码示例来源:origin: com.bitplan.antlr/com.bitplan.antlr

public LinePainter(JTextComponent component) {
 this(component, null);
 // http://www.colourlovers.com/color/FF9494/error_red
 errorColor = new Color(255, 148, 148);
 setLighter(component.getSelectionColor());
}

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

public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
   Rectangle alloc = bounds.getBounds();
   try {
     // --- determine locations ---
     TextUI mapper = c.getUI();
     Rectangle p0 = mapper.modelToView(c, offs0);
     Rectangle p1 = mapper.modelToView(c, offs1);
     // --- render ---
     Color color = getColor();
     if (color == null) {
       g.setColor(c.getSelectionColor());
     }
     else {
       g.setColor(color);
     }

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

/**
 * Paints a highlight over a line just uses the first point a work around only
 */
@Override
public Shape paintLayer( Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c, View view )
{
 Color color = getColor();
 if( color == null )
 {
  g.setColor( c.getSelectionColor() );
 }
 else
 {
  g.setColor( color );
 }
 return paintUnderline( g, offs0, offs1, c, color );
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

JTextComponent c,
  View view) {
g.setColor(color == null ? c.getSelectionColor() : color);

代码示例来源:origin: org.jclarion/clarion-runtime

public Shape paintLayer(Graphics g, int offs0, int offs1, Shape bounds,
  JTextComponent c, View view) {
 g.setColor(color == null ? c.getSelectionColor() : color);

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

/**
 * Returns the color of the right {@link #type type} used by the specified component.
 * @param  component component to analyse.
 * @return           the color of the right {@link #type type} used by the specified component.
 */
private Color getColor(JComponent component) {
  // Foreground color.
  if(type == FOREGROUND)
    return component.getForeground();
  // Background color.
  else if(type == BACKGROUND)
    return component.getBackground();
  // Text component specific colors.
  else if(component instanceof JTextComponent) {
    JTextComponent comp;
    comp = (JTextComponent)component;
    // Selection foreground color.
    if(type == SELECTION_FOREGROUND)
      return comp.getSelectedTextColor();
    // Selection background color.
    else if(type == SELECTION_BACKGROUND)
      return comp.getSelectionColor();
  }
  return null;
}

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

Paint paint = getPaint();
if (paint==null) {
  g2d.setColor(c.getSelectionColor());

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

Paint paint = getPaint();
if (paint==null)
  g2d.setColor(c.getSelectionColor());
else
  g2d.setPaint(paint);

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

Paint paint = getPaint();
if (paint==null)
  g2d.setColor(c.getSelectionColor());
else
  g2d.setPaint(paint);

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

g.setColor(c.getSelectionColor());

代码示例来源:origin: org.jspresso.framework/jspresso-swing-application

/**
 * {@inheritDoc}
 */
@Override
protected void protectedReadabilityChange() {
 super.protectedReadabilityChange();
 if (isReadable()) {
  if (savedSelectedTextColor != null) {
   getConnectedJComponent().setSelectedTextColor(savedSelectedTextColor);
  }
  savedSelectedTextColor = null;
 } else if (savedSelectedTextColor == null) {
  savedSelectedTextColor = getConnectedJComponent().getSelectedTextColor();
  getConnectedJComponent().setSelectedTextColor(
    getConnectedJComponent().getSelectionColor());
 }
}

代码示例来源:origin: org.jspresso/jspresso-swing-application

/**
  * {@inheritDoc}
  */
 @Override
 protected void protectedUpdateState() {
  super.protectedUpdateState();
  if (isReadable()) {
   if (savedSelectedTextColor != null) {
    getConnectedJComponent().setSelectedTextColor(savedSelectedTextColor);
   }
   savedSelectedTextColor = null;
  } else if (savedSelectedTextColor == null) {
   savedSelectedTextColor = getConnectedJComponent().getSelectedTextColor();
   getConnectedJComponent().setSelectedTextColor(
     getConnectedJComponent().getSelectionColor());
  }
  getConnectedJComponent().setEditable(isWritable());
 }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

promptComponent.getHighlighter().addHighlight(0,
        promptComponent.getText().length(),
        new DefaultHighlightPainter(txt.getSelectionColor()));
  } catch (BadLocationException e) {
    e.printStackTrace();
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());
promptComponent.setMargin(txt.getMargin());

代码示例来源:origin: org.swinglabs.swingx/swingx-all

promptComponent.getHighlighter().addHighlight(0,
        promptComponent.getText().length(),
        new DefaultHighlightPainter(txt.getSelectionColor()));
  } catch (BadLocationException e) {
    e.printStackTrace();
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());
promptComponent.setMargin(txt.getMargin());

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

Color s = c.getSelectionColor();

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

Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
  editor.setSelectionColor(plaf.getColor(prefix + ".selectionBackground"));

相关文章

JTextComponent类方法