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

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

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

JTextComponent.setSelectedTextColor介绍

暂无

代码示例

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

editor.setSelectedTextColor(c);

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

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class RunnableTest{    
  public static void main(String args[]){

    JFrame frame = new JFrame("frame");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    JTextField textfield = new JTextField();
    textfield.setPreferredSize(new Dimension(400,30));
    textfield.setForeground(Color.black);
    textfield.setBackground(Color.black);
    textfield.setSelectedTextColor(Color.black);
    textfield.setSelectionColor(Color.black);

    frame.getContentPane().add(panel);
    panel.add(textfield);
    frame.pack();

     frame.setVisible(true);    
  } 
}

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

hl.setDrawsLayeredHighlights(false);
textArea.setSelectionColor(Color.RED);
textArea.setSelectedTextColor(Color.WHITE);
try (Reader reader = new BufferedReader(new InputStreamReader(
   new FileInputStream("SelectionTypeTest.java"), "UTF-8"))) {

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

editorPane.setSelectedTextColor(Color.red);

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

editorPane.setSelectedTextColor(Color.red);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf

public static void syncWithTheme(Graphics2D g, Component c) {
  if (isPaper(c)) {
    paperStack.push(c);
    themeStack.push((NapkinTheme) ((JComponent) c).getClientProperty(
        THEME_KEY));
    dumpStacks();
  }
  NapkinTheme theme = currentTheme(c);
  Color themePen = theme.getPenColor();
  Color fgColor = ifReplace(c.getForeground(), themePen);
  // explicitly check for equality because two things depend on it
  if (!fgColor.equals(c.getForeground())) {
    c.setForeground(fgColor);
    if (g != null) {
      g.setColor(fgColor);
    }
  }
  if (c instanceof JTextComponent) {
    JTextComponent tc = (JTextComponent) c;
    Color selColor = ifReplace(tc.getSelectedTextColor(), themePen);
    // just set, as the method does work only if it's different
    tc.setSelectedTextColor(selColor);
  }
}

代码示例来源:origin: atarw/material-ui-swing

private void installMyDefaults() {
  this.activeBackground = UIManager.getColor("TextField.selectionBackground");
  this.activeForeground = UIManager.getColor("TextField.selectionForeground");
  this.inactiveBackground = UIManager.getColor("TextField.inactiveBackground");
  this.inactiveForeground = UIManager.getColor("TextField.inactiveForeground");
  getComponent().setFont(MaterialFonts.REGULAR);
  getComponent().setSelectionColor(getComponent().hasFocus() && getComponent().isEnabled() ? activeBackground : inactiveBackground);
  getComponent().setSelectedTextColor(getComponent().hasFocus() && getComponent().isEnabled() ? activeForeground : inactiveForeground);
  getComponent().setForeground(getComponent().hasFocus() && getComponent().isEnabled() ? activeForeground : inactiveForeground);
  getComponent().setBorder(BorderFactory.createEmptyBorder(3, 5, 2,5));
}
@Override

代码示例来源: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: com.fifesoft/rsyntaxtextarea

editor.setSelectedTextColor(c);

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

editor.setSelectedTextColor(c);

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

editor.setSelectedTextColor(c);

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());

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

promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());

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

promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());

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

promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());

代码示例来源:origin: org.xworker/xworker_core

comp.setSelectedTextColor(selectedTextColor);

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

c.setSelectedTextColor(style.getColor(context, ColorType.TEXT_FOREGROUND));

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

editor.setSelectedTextColor(plaf.getColor(prefix + ".selectionForeground"));

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

editor.setSelectedTextColor(plaf.getColor(prefix + ".selectionForeground"));

相关文章

JTextComponent类方法