本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}