當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。