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

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

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

JComboBox.setBackground介绍

暂无

代码示例

代码示例来源:origin: pentaho/mondrian

listRenderer.setMaximumSize(stringRenderer.getMaximumSize());
listRenderer.setFont(Font.decode("Dialog"));
listRenderer.setBackground(Color.white);
relationList.setMinimumSize(new Dimension(55, 22));
relationList.setFont(Font.decode("Dialog"));
relationList.setBackground(Color.white);

代码示例来源:origin: pentaho/mondrian

schemaList.setBackground(Color.white);
final JPanel qpanel = this;
schemaList.addItemListener(

代码示例来源:origin: pentaho/mondrian

listEditor.setMaximumSize(stringEditor.getMaximumSize());
listEditor.setFont(Font.decode("Dialog"));
listEditor.setBackground(Color.white);
listEditor.setBorder(
  new EmptyBorder(

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

public void itemStateChanged(java.awt.event.ItemEvent evt)
 {
  myBox.setBackground(java.awt.Color.white);
 }
});

代码示例来源:origin: fcrepo3/fcrepo

public void actionPerformed(ActionEvent evt) {
    if (m_stateComboBox.getSelectedIndex() == 0) {
      m_stateComboBox.setBackground(Administrator.ACTIVE_COLOR);
    } else if (m_stateComboBox.getSelectedIndex() == 1) {
      m_stateComboBox.setBackground(Administrator.INACTIVE_COLOR);
    } else {
      m_stateComboBox.setBackground(Administrator.DELETED_COLOR);
    }
  }
});

代码示例来源:origin: eu.agrosense.client/io-shape

private ShapeContentFormRow(boolean required, JLabel label, JComboBox<String> component) {
  super(required, label, component);
  this.propertiesComboBox = component;
  this.propertiesComboBox.setBackground(Color.WHITE);
  this.propertiesModel = (DefaultComboBoxModel<String>) component.getModel();
}

代码示例来源:origin: com.jtattoo/JTattoo

public void focusLost(FocusEvent e) {
    if (comboBox != null) {
      if (orgBorder instanceof UIResource) {
        comboBox.setBorder(orgBorder);
      }
      comboBox.setBackground(orgBackgroundColor);
    }
  }
};

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

@Override
public void setBackground(Color bg) {
 getComboBox().setBackground(bg);
}

代码示例来源:origin: sc.fiji/TrakEM2_

public JComboBox addChoice(String label, String[] items, int selected, Setter setter) {
  addLabel(label);
  JComboBox choice = new JComboBox(items);
  choice.setBackground(Color.white);
  choice.setSelectedIndex(selected);
  choice.addActionListener(tl);
  all.add(choice);
  addField(choice, setter);
  return choice;
}

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

String[] numbers = {"1","2","3","4","5","6","7","8","9","10"};
JComboBox numberbox = null;
for(int j = 1; j <= 12; j++){
 numberbox = new JComboBox(numbers); 
 numberbox.setLocation(103,j*30);
 numberbox.setSize(47,26);
 numberbox.setSelectedIndex(1);
 numberbox.setBackground(Color.WHITE);
 panelForTextFields.add(numberbox);
 numberbox.addActionListener(this);
}

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

/**
 * Creates undoable JComboBox.
 * 
 */
public <T> JComboBox<T> createUndoableComboBox() {
  JComboBox<T> comboBox = new JComboBox<>();
  comboBox.addItemListener(new JComboBoxUndoListener());
  comboBox.setBackground(Color.WHITE);
  comboBox.setMaximumRowCount(ModelerPreferences.COMBOBOX_MAX_VISIBLE_SIZE);
  return comboBox;
}

代码示例来源:origin: net.sf.sfac/sfac-core

@Override
protected void fireObjectSelectionChanged() {
  super.fireObjectSelectionChanged();
  JComboBox comboBox = getComboBox();
  Color selected = (Color) comboBox.getSelectedItem();
  if (selected == null) selected = DEFAULT_BACKGROUND_COLOR;
  comboBox.setBackground(selected);
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * @return A new read only combo box (no listeners attached)
 */
public static <T> JComboBox<T> newReadOnlyComboBox(T[] items) {
 JComboBox<T> comboBox = newComboBox(items);
 comboBox.setEditable(false);
 // Apply theme
 comboBox.setBackground(Themes.currentTheme.readOnlyComboBox());
 return comboBox;
}

代码示例来源:origin: pentaho/pentaho-reporting

protected void configureEditorStyle( final Font font, final Color foreground, final Color background ) {
 comboBox.setFont( font );
 comboBox.setForeground( foreground );
 comboBox.setBackground( background );
}

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

JComboBox combo = new JComboBox(new Object[]{"Dog", "Cat", "Bird"});
combo.setBackground(Color.WHITE);
combo.setForeground(Color.BLACK);
combo.setFocusable(false);

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

/**
 * Creates a new JComboBox.
 */
public <T> JComboBox<T> createComboBox() {
  JComboBox<T> comboBox = new JComboBox<>();
  comboBox.setFont(UIManager.getFont("Label.font"));
  comboBox.setBackground(Color.WHITE);
  comboBox.setMaximumRowCount(ModelerPreferences.COMBOBOX_MAX_VISIBLE_SIZE);
  return comboBox;
}

代码示例来源:origin: org.biojava.thirdparty/forester

private void addClickToOption( final int which, final String title ) {
  _click_to_combobox.addItem( title );
  _click_to_names.add( title );
  _all_click_to_names.put( new Integer( which ), title );
  if ( !_configuration.isUseNativeUI() ) {
    _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
    _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
  }
}

代码示例来源:origin: Exslims/MercuryTrade

public JComboBox getComboBox(String[] child) {
  JComboBox comboBox = new JComboBox<>(child);
  comboBox.setBackground(AppThemeColor.HEADER);
  comboBox.setForeground(AppThemeColor.TEXT_DEFAULT);
  comboBox.setFont(BOLD_FONT.deriveFont(scale * 16f));
  comboBox.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1));
  comboBox.setUI(MercuryComboBoxUI.createUI(comboBox));
  return comboBox;
}

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

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JComboBox<?> comboBox = (JComboBox<?>) c;
  comboBox.setFont (UIManager.getFont ("ComboBox.font"));
  comboBox.setBackground (UIManager.getColor ("ComboBox.background"));
  comboBox.setForeground (UIManager.getColor ("ComboBox.foreground"));
  comboBox.setBorder (UIManager.getBorder ("ComboBox.border"));
  comboBox.setLightWeightPopupEnabled (true);
  comboBox.setRenderer (new MaterialComboBoxRenderer ());
}

代码示例来源:origin: igniterealtime/Spark

public Component getTableCellRendererComponent(JTable table, Object value,
                          boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected) {
      setForeground(table.getSelectionForeground());
      super.setBackground(table.getSelectionBackground());
    }
    else {
      setForeground(table.getForeground());
      setBackground(table.getBackground());
    }
    // Select the current value
    setSelectedItem(value);
    return this;
  }
}

相关文章

JComboBox类方法