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

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

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

JComboBox.getForeground介绍

暂无

代码示例

代码示例来源:origin: google/sagetv

public boolean isNameSolid() { return fontNameC.getForeground() == java.awt.Color.black; }
public boolean isStyleSolid() { return fontStyleC.getForeground() == java.awt.Color.black; }

代码示例来源:origin: google/sagetv

public boolean isStyleSolid() { return fontStyleC.getForeground() == java.awt.Color.black; }

代码示例来源:origin: org.japura/japura-gui

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

代码示例来源:origin: google/sagetv

public void acceptEdit()
{
 if (hookChoice.getForeground() == java.awt.Color.black)
 {
  for (int i = 0; i < widgs.length; i++)
  {
   Widget widg = widgs[i];
   Object o = hookChoice.getSelectedItem();
   if (o == null)
    WidgetFidget.setName(widg, "");
   else
   {
    String s = o.toString();
    WidgetFidget.setName(widg, s);
    if (s.length() > 0)
     WidgetFidget.setName(widg, s.substring(0, s.indexOf('(')));
   }
  }
 }
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  // Set the background and foreground to the combobox colors.
  if (enabled) {
    setBackground(comboBox.getBackground());
    setForeground(comboBox.getForeground());
  } else {
    setBackground(UIManager.getColor("ComboBox.disabledBackground"));
    setForeground(UIManager.getColor("ComboBox.disabledForeground"));
  }
}

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

public void setNoResults (boolean areNoResults) {
  // no op when called too soon
  if (command == null || origForeground == null) {
    return;
  }
  // don't alter color if showing hint already
  if (command.getForeground().equals(((JTextField) command.getEditor().getEditorComponent()).getDisabledTextColor())) {
    return;
  }
  command.setForeground(areNoResults ? Color.RED : origForeground);
}

代码示例来源:origin: google/sagetv

public void itemStateChanged(java.awt.event.ItemEvent evt)
 {
  if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED)
  {
   if (catChoice.getForeground() != java.awt.Color.black)
   {
    catChoice.setForeground(java.awt.Color.black);
    methChoice.setForeground(java.awt.Color.black);
    catChoice.repaint();
    methChoice.repaint();
   }
   java.util.ArrayList methList = (java.util.ArrayList) Catbert.categoryMethodMap.get(evt.getItem());
   if (methList != null)
   {
    String[] methArr = (String[]) methList.toArray(new String[0]);
    java.util.Arrays.sort(methArr);
    synchronized (methChoice.getTreeLock())
    {
     methChoice.removeAllItems();
     methChoice.addItem("");
     for (int i = 0; i < methArr.length; i++)
      methChoice.addItem(methArr[i]);
    }
    //win.pack();
   }
  }
 }
});

代码示例来源:origin: google/sagetv

public void itemStateChanged(java.awt.event.ItemEvent evt)
 if (catChoice.getForeground() != java.awt.Color.black)

代码示例来源:origin: google/sagetv

public void acceptEdit() throws ParseException
{
 for (int j = 0; j < widgs.length; j++)
 {
  Widget widg = widgs[j];
  if (nameField.getBackground() == java.awt.Color.white)
   // 601 widg.setName(nameField.getText());
   WidgetFidget.setName(widg, nameField.getText());
  Object o = methChoice.getSelectedItem();
  if (methChoice.getForeground() == java.awt.Color.black)
   widg.setTempProperty("Method", (o == null) ? "" : o.toString());
  for (int i = 0; i < varNameFields.length; i++)
   if (varNameFields[i].getBackground() == java.awt.Color.white)
    widg.setTempProperty("Variable"+i, varNameFields[i].getText());
  if (prefixField.getBackground() == java.awt.Color.white)
   widg.setTempProperty("Prefix", prefixField.getText());
  if (suffixField.getBackground() == java.awt.Color.white)
   widg.setTempProperty("Suffix", suffixField.getText());
 }
 // nielm: syntax check 0th widget so that all edits get applied,
 // but only one error triggered
 Catbert.precompileWidget(widgs[0]);
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

c.setForeground(comboBox.getForeground());
  c.setBackground(comboBox.getBackground());
} else {

代码示例来源:origin: com.synaptix/SynaptixTattoo

/**
 * Configures the list which is used to hold the combo box items in the
 * popup. This method is called when the UI class is created.
 * 
 * @see #createList
 */
protected void configureList() {
  list.setFont(comboBox.getFont());
  list.setForeground(comboBox.getForeground());
  list.setBackground(comboBox.getBackground());
  list.setSelectionForeground(UIManager
      .getColor("ComboBox.selectionForeground"));
  list.setSelectionBackground(UIManager
      .getColor("ComboBox.selectionBackground"));
  list.setBorder(null);
  list.setCellRenderer(comboBox.getRenderer());
  list.setFocusable(false);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setListSelection(comboBox.getSelectedIndex());
  installListListeners();
}

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

c.setForeground(comboBox.getForeground());
c.setBackground(comboBox.getBackground());

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) {
  ListCellRenderer renderer = comboBox.getRenderer();
  //Fix for an obscure condition when renderer may be null -
  //can't figure how this can happen unless the combo box is
  //painted before installUI() has completed (which is called
  //by the superclass constructor calling updateUI().  Only
  //happens when opening an individual Properties window.  Maybe
  //the window is constructed off the AWT thread?
  if ((listBox == null) || (renderer == null)) {
    return;
  }
  Component c;
  c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false);
  c.setFont(comboBox.getFont());
  c.setForeground(comboBox.isEnabled() ? comboBox.getForeground() : PropUtils.getDisabledForeground());
  c.setBackground(comboBox.getBackground());
  boolean shouldValidate = false;
  if (c instanceof JPanel) {
    shouldValidate = true;
  }
  currentValuePane.paintComponent(
    g, c, comboBox, bounds.x, bounds.y, bounds.width, bounds.height, shouldValidate
  );
}

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

public void paintCurrentValue(Graphics g, Rectangle bounds,boolean hasFocus) {
  ListCellRenderer renderer = comboBox.getRenderer();
  //Fix for an obscure condition when renderer may be null -
  //can't figure how this can happen unless the combo box is
  //painted before installUI() has completed (which is called
  //by the superclass constructor calling updateUI().  Only
  //happens when opening an individual Properties window.  Maybe
  //the window is constructed off the AWT thread?
  if ((listBox == null) || (renderer == null)) {
    return;
  }
  Component c;
  c = renderer.getListCellRendererComponent( listBox,
                          comboBox.getSelectedItem(),
                          -1,
                          false,
                          false );
  c.setFont(comboBox.getFont());
  c.setForeground(comboBox.isEnabled() ? comboBox.getForeground() : 
    PropUtils.getDisabledForeground());
    
  c.setBackground(comboBox.getBackground());
  boolean shouldValidate = false;
  if (c instanceof JPanel)  {
    shouldValidate = true;
  }
  currentValuePane.paintComponent(g,c,comboBox,bounds.x,bounds.y,
                  bounds.width,bounds.height, shouldValidate);
}

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

public void paintCurrentValue(Graphics g, Rectangle bounds,boolean hasFocus) {
  ListCellRenderer renderer = comboBox.getRenderer();
  //Fix for an obscure condition when renderer may be null -
  //can't figure how this can happen unless the combo box is
  //painted before installUI() has completed (which is called
  //by the superclass constructor calling updateUI().  Only
  //happens when opening an individual Properties window.  Maybe
  //the window is constructed off the AWT thread?
  if ((listBox == null) || (renderer == null)) {
    return;
  }
  Component c;
  c = renderer.getListCellRendererComponent( listBox,
                          comboBox.getSelectedItem(),
                          -1,
                          false,
                          false );
  c.setFont(comboBox.getFont());
  c.setForeground(comboBox.isEnabled() ? comboBox.getForeground() : 
    PropUtils.getDisabledForeground());
    
  c.setBackground(comboBox.getBackground());
  boolean shouldValidate = false;
  if (c instanceof JPanel)  {
    shouldValidate = true;
  }
  currentValuePane.paintComponent(g,c,comboBox,bounds.x,bounds.y,
                  bounds.width,bounds.height, shouldValidate);
}

代码示例来源:origin: net.sf.nimrod/nimrod-laf

c.setForeground( comboBox.getForeground());
c.setForeground( comboBox.getForeground());
c.setBackground( comboBox.getBackground());

相关文章

JComboBox类方法