Java Code Examples for javax.swing.JComboBox.setBackground()

The following are Jave code examples for showing how to use setBackground() of the javax.swing.JComboBox class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: rapidminer   File: ExampleSourceConfigurationWizardValueTypeTable.java   Source Code and License Vote up 6 votes
@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);
}
 
Example 2
Project: OpenDA   File: Query.java   Source Code and License Vote up 6 votes
/** 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));
}
 
Example 3
Project: rapidminer   File: ExampleSourceConfigurationWizardAttributeTypeTable.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 4
Project: COE1186   File: SimulatorGui.java   Source Code and License Vote up 5 votes
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);
}
 
Example 5
Project: COE1186   File: SimulatorGui.java   Source Code and License Vote up 5 votes
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);
}
 
Example 6
Project: COE1186   File: CtcGui.java   Source Code and License Vote up 5 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
Example 7
Project: COE1186   File: MboGui.java   Source Code and License Vote up 5 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
Example 8
Project: jmt   File: ComboBoxCell.java   Source Code and License Vote up 4 votes
public ComboBoxCell(Object[] valueSet) {
	super(new JComboBox(valueSet));
	jcb = (JComboBox) getComponent();
	jcb.setBackground(Color.WHITE);
	jcb.addActionListener(this);
}
 
Example 9
Project: QN-ACTR-Release   File: ComboBoxCell.java   Source Code and License Vote up 4 votes
public ComboBoxCell(Object[] valueSet) {
	super(new JComboBox(valueSet));
	jcb = (JComboBox) getComponent();
	jcb.setBackground(Color.WHITE);
	jcb.addActionListener(this);
}
 
Example 10
Project: COE1186   File: TrackControllerGUI.java   Source Code and License Vote up 4 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
Example 11
Project: COE1186   File: TrainModelGUI.java   Source Code and License Vote up 4 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
Example 12
Project: COE1186   File: TrainControllerGUI.java   Source Code and License Vote up 4 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
Example 13
Project: COE1186   File: TrnControllerGUI.java   Source Code and License Vote up 4 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}
 
Example 14
Project: COE1186   File: TrackModelGUI.java   Source Code and License Vote up 4 votes
public void stylizeComboBox(JComboBox c){
	c.setFont(font_14_bold);
	((JLabel)c.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	c.setForeground(Color.BLACK);
	c.setBackground(Color.WHITE);
}