javax.swing.JTextField.setSelectionColor()方法的使用及代码示例

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

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

JTextField.setSelectionColor介绍

暂无

代码示例

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

this.textField.setOpaque(false);
this.textField.setSelectedTextColor(Color.WHITE);
this.textField.setSelectionColor(ColorScheme.BRAND_ORANGE_TRANSPARENT);

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

public void setSelectionBackground(Color color) {
  if(renderer != null) {
    renderer.setSelectionBackground(color);
  textField.setSelectionColor(color);
  }
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * Highlights the next selection.
 */
private void highlightNextSelection() {
  System.out.println("Highlighting next selection.");
  if (!this.selections.isEmpty()) {
    Selection sel = this.selections.get(0);
    this.expression.setSelectionColor(SELECTION);
    this.expression.select(sel.x, sel.y);
    this.expression.grabFocus();
  }
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * @return the expression.
 *
 * @throws java.text.ParseException - If the values in the editor are not well-formed.
 */
public Equation getEquation() throws ParseException {
  if (!NamingProtocol.isLegalName(this.variable.getText())) {
    this.variable.setSelectionColor(Color.RED);
    this.variable.select(0, this.variable.getText().length());
    this.variable.grabFocus();
    throw new ParseException(NamingProtocol.getProtocolDescription(), 1);
  }
  String equation = this.variable.getText() + "=" + this.expression.getText();
  try {
    return this.parser.parseEquation(equation);
  } catch (ParseException ex) {
    this.expression.setSelectionColor(Color.RED);
    this.expression.select(ex.getErrorOffset() - 1, this.expression.getText().length());
    this.expression.grabFocus();
    throw ex;
  }
}

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

findWhatField.setSelectionColor(UIConstants.TABLE_SELECTION_BACKGROUND_COLOR);
findWhatField.setSelectedTextColor(UIConstants.TABLE_SELECTION_FOREGROUND_COLOR);
findWhatField.setPreferredSize(new Dimension(260, findWhatField.getPreferredSize().height));

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

private void changeColorOnFocus(boolean hasFocus) {
  JTextField c = (JTextField) getComponent();
  /*c.setSelectionColor(hasFocus ? activeBackground : inactiveBackground);
  c.setForeground(hasFocus ? activeForeground : inactiveForeground);
  c.setSelectedTextColor(hasFocus ? activeForeground : inactiveForeground);*/
  if(hasFocus && (activeBackground != null) && (activeForeground != null)){
    c.setSelectionColor(activeBackground);
    c.setForeground(activeForeground);
    c.setSelectedTextColor(activeForeground);
  }
  if(!hasFocus && (inactiveBackground != null) && (inactiveForeground != null)){
    c.setSelectionColor(inactiveBackground);
    c.setForeground(inactiveForeground);
    c.setSelectedTextColor(inactiveForeground);
  }
  c.paint(c.getGraphics());
}

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

JTextField textField = (JTextField) filterRow.getComponent(i);
textField.setEditable(false);
textField.setSelectionColor(HeaderColor);
Dimension d = textField.getPreferredSize();
if(i==0){

相关文章

JTextField类方法