当前位置: 首页>>代码示例>>Java>>正文


Java JComboBox.setBackground方法代码示例

本文整理汇总了Java中javax.swing.JComboBox.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JComboBox.setBackground方法的具体用法?Java JComboBox.setBackground怎么用?Java JComboBox.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JComboBox的用法示例。


在下文中一共展示了JComboBox.setBackground方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCellEditor

import javax.swing.JComboBox; //导入方法依赖的package包/类
@Override
public TableCellEditor getCellEditor(int row, int column) {
	List<String> usedTypes = new LinkedList<String>();
	for (int i = 0; i < Ontology.VALUE_TYPE_NAMES.length; i++) {
		if ((i != Ontology.ATTRIBUTE_VALUE) && (i != Ontology.FILE_PATH)
				&& (!Ontology.ATTRIBUTE_VALUE_TYPE.isA(i, Ontology.DATE_TIME))) {
			usedTypes.add(Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(i));
		}
	}
	String[] valueTypes = new String[usedTypes.size()];
	int vCounter = 0;
	for (String type : usedTypes) {
		valueTypes[vCounter++] = type;
	}
	JComboBox typeBox = new JComboBox(valueTypes);
	typeBox.setBackground(javax.swing.UIManager.getColor("Table.cellBackground"));
	return new DefaultCellEditor(typeBox);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:ExampleSourceConfigurationWizardValueTypeTable.java

示例2: addChoice

import javax.swing.JComboBox; //导入方法依赖的package包/类
/** Create a choice menu.
 *  @param name The name used to identify the entry (when calling get).
 *  @param label The label to attach to the entry.
 *  @param values The list of possible choices.
 *  @param defaultChoice Default choice.
 *  @param editable True if an arbitrary choice can be entered, in addition
 *   to the choices in values.
 *  @param background The background color for the editable part.
 */
public void addChoice(
        String name,
        String label,
        String[] values,
        String defaultChoice,
        boolean editable,
        Color background) {
    JLabel lbl = new JLabel(label + ": ");
    lbl.setBackground(_background);
    JComboBox combobox = new JComboBox(values);
    combobox.setEditable(editable);
    // FIXME: Typical of Swing, the following does not set
    // the background color.  How does one set the background
    // color?
    combobox.setBackground(background);
    combobox.setSelectedItem(defaultChoice);
    _addPair(name, lbl, combobox, combobox);
    // Add the listener last so that there is no notification
    // of the first value.
    combobox.addItemListener(new QueryItemListener(name));
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:31,代码来源:Query.java

示例3: getCellEditor

import javax.swing.JComboBox; //导入方法依赖的package包/类
@Override
public TableCellEditor getCellEditor(int row, int column) {
	JComboBox typeBox = new JComboBox(Attributes.KNOWN_ATTRIBUTE_TYPES);
	typeBox.setEditable(true);
	typeBox.setBackground(javax.swing.UIManager.getColor("Table.cellBackground"));
	return new DefaultCellEditor(typeBox);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ExampleSourceConfigurationWizardAttributeTypeTable.java

示例4: stylizeComboBox_disabled

import javax.swing.JComboBox; //导入方法依赖的package包/类
public void stylizeComboBox_disabled(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(new Color(26, 29, 35));
	c.setEnabled(false);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:8,代码来源:SimulatorGui.java

示例5: stylizeComboBox

import javax.swing.JComboBox; //导入方法依赖的package包/类
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
	c.setEnabled(true);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:8,代码来源:SimulatorGui.java

示例6: stylizeComboBox

import javax.swing.JComboBox; //导入方法依赖的package包/类
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:7,代码来源:CtcGui.java

示例7: ComboBoxCell

import javax.swing.JComboBox; //导入方法依赖的package包/类
public ComboBoxCell(Object[] valueSet) {
	super(new JComboBox(valueSet));
	jcb = (JComboBox) getComponent();
	jcb.setBackground(Color.WHITE);
	jcb.addActionListener(this);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:7,代码来源:ComboBoxCell.java


注:本文中的javax.swing.JComboBox.setBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。