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

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

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

JTextField.getForeground介绍

暂无

代码示例

代码示例来源:origin: JetBrains/ideavim

myEntry.setFont(font);
setForeground(myEntry.getForeground());
setBackground(myEntry.getBackground());
myLabel.setForeground(myEntry.getForeground());
myLabel.setBackground(myEntry.getBackground());

代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing

@Override
public Color getDefaultForeground() {
  return super.getForeground();
}

代码示例来源:origin: org.softsmithy.lib/lib-core

@Override
public Color getDefaultForeground() {
  return super.getForeground();
}

代码示例来源:origin: org.apache.airavata/airavata-common-utils

public void focusLost(FocusEvent arg0) {
    if (field.getText().trim().equals("")){
      fontColor=field.getForeground();
      field.setForeground(Color.GRAY);
      field.setText(placeHolderText);
    }
  }
});

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

/**
 * After any user input, the value of the textfield is proofed. Depending on
 * being an integer, the value is colored green or red. If the textfield is
 * green, the enter key is accepted and the new value is set.
 *
 * @param e
 *            Description of the Parameter
 */
public void actionPerformed(final ActionEvent e) {
  if (textField.getForeground().equals(darkGreen)) {
    setValue(Integer.valueOf(textField.getText()).intValue());
  }
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components

/**
 * Creates a label for one of the fields used to display the graph's current
 * values. Neither the label created by this method or the
 * <code>field</code> passed as a parameter is added to the GUI here.
 *
 * @param labelResourceName
 *            the name of the label resource. This is used to look up the
 *            label text using {@link JMeterUtils#getResString(String)}.
 * @param field
 *            the field this label is being created for.
 */
private JLabel createInfoLabel(String labelResourceName, JTextField field) {
  JLabel label = new JLabel(JMeterUtils.getResString(labelResourceName));
  label.setForeground(field.getForeground());
  label.setLabelFor(field);
  return label;
}

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

public SourceFilesPanel(Project project) {
  this.controller = null;
  this.project = project;
  initComponents();
  defaultTextFieldFg = excludePatternTextField.getForeground();
  init();
}

代码示例来源:origin: org.scijava/scijava-ui-swing

private void initPrompt(String text) {
  prompt.setText(text);
  prompt.setFont(textField.getFont().deriveFont(Font.ITALIC));
  prompt.setForeground(changeAlpha(textField.getForeground(), 128));
  prompt.setBorder(new EmptyBorder(textField.getInsets()));
  prompt.setHorizontalAlignment(SwingConstants.LEADING);
  textField.setLayout(new BorderLayout());
  textField.add(prompt);
  updatePromptVisibility();
}

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

public PathCellRenderer(FileSystem fileSystem) {
  super();
    setLayout(new BorderLayout());
    add(field, BorderLayout.CENTER);
    field.setBorder(noFocusBorder);
    textFieldColor = field.getForeground();
    redTextFieldColor = new Color(field.getBackground().getRed(), textFieldColor.getGreen(), textFieldColor.getBlue());
    add(button, BorderLayout.EAST);
    button.setPreferredSize(new Dimension(BUTTON_WIDTH,5));
    button.setMaximumSize(new Dimension(BUTTON_WIDTH,20));
    button.setBorder(noFocusButtonBorder);
    this.fileSystem = fileSystem;
}

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

/** Creates new form SourceFilesPanel */
/*package*/ SourceFilesPanel(SourceFoldersDescriptorPanel controller) {
  this.controller = controller;
  this.project = null;
  initComponents();
  defaultTextFieldFg = excludePatternTextField.getForeground();
  init();
}

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

public void updateForeground() {
  color.setValue(Utils.applyAlphaMask(target.getForeground(), HINT_OPACITY_MASK));
}

代码示例来源:origin: net.sf.mmax2/mmax2

public void mouseClicked(java.awt.event.MouseEvent e)
{
  JTextField source = (JTextField) e.getSource();        
  Color c = JColorChooser.showDialog(source.getParent(),"Choose markable level color",source.getForeground());
  source.setForeground(c);               
}

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

@Override
public void addNotify() {
  super.addNotify();
  if (previousBackgroundColor == null) {
    previousBackgroundColor = searchField.getBackground();
    previousForegroundColor = searchField.getForeground();
  } else {
    searchField.setBackground(previousBackgroundColor);
    searchField.setForeground(previousForegroundColor);
  }
}

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

@Override
public void addNotify() {
  super.addNotify();
  if (previousBackgroundColor == null) {
    previousBackgroundColor = searchField.getBackground();
    previousForegroundColor = searchField.getForeground();
  } else {
    searchField.setBackground(previousBackgroundColor);
    searchField.setForeground(previousForegroundColor);
  }
}

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

@Override
public void addNotify() {
  super.addNotify();
  if (previousBackgroundColor == null) {
    previousBackgroundColor = searchField.getBackground();
    previousForegroundColor = searchField.getForeground();
  } else {
    searchField.setBackground(previousBackgroundColor);
    searchField.setForeground(previousForegroundColor);
  }
}

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

@Override
public void addNotify() {
  super.addNotify();
  if (previousBackgroundColor == null) {
    previousBackgroundColor = searchField.getBackground();
    previousForegroundColor = searchField.getForeground();
  } else {
    searchField.setBackground(previousBackgroundColor);
    searchField.setForeground(previousForegroundColor);
  }
}

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

@Override
public void addNotify() {
  super.addNotify();
  if (previousBackgroundColor == null) {
    previousBackgroundColor = searchField.getBackground();
    previousForegroundColor = searchField.getForeground();
  } else {
    searchField.setBackground(previousBackgroundColor);
    searchField.setForeground(previousForegroundColor);
  }
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
  public void run() {
    if (textField == null)
      return;
    Color foregr = textField.getForeground();
    if ((foregr == null) || (foregr instanceof UIResource)) {
      textField
          .setForeground(SubstanceColorUtilities
              .getForegroundColor(SubstanceLookAndFeel
                  .getCurrentSkin(textField)
                  .getEnabledColorScheme(
                      SubstanceLookAndFeel
                          .getDecorationType(textField))));
    }
  }
});

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

@Override
  public void run() {
    if (textField == null)
      return;
    Color foregr = textField.getForeground();
    if ((foregr == null) || (foregr instanceof UIResource)) {
      textField
          .setForeground(SubstanceColorUtilities
              .getForegroundColor(SubstanceLookAndFeel
                  .getCurrentSkin(textField)
                  .getEnabledColorScheme(
                      SubstanceLookAndFeel
                          .getDecorationType(textField))));
    }
  }
});

代码示例来源:origin: it.tidalwave.metadata/it-tidalwave-metadata-viewer

@Test
 public void testSetForeground()
  {
   final Color color = new Color(10, 20, 40);
   pane.setForeground(color);
   assertEquals(color, pane.getForeground());
   assertEquals(color, pane.tfName.getForeground());
   assertEquals(color, pane.cbNameAvailable.getForeground());
  }
}

相关文章

微信公众号

最新文章

更多

JTextField类方法