本文整理汇总了Java中org.eclipse.swt.custom.CCombo.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java CCombo.setBackground方法的具体用法?Java CCombo.setBackground怎么用?Java CCombo.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.setBackground方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
protected Control createControl() {
m_Combo = new CCombo(m_Table, SWT.READ_ONLY);
m_Combo.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_LIST_BACKGROUND));
if (m_Items != null)
m_Combo.setItems(m_Items);
m_Combo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
try {
onKeyPressed(e);
} catch (Exception ex) {
}
}
});
/*
* m_Combo.addTraverseListener(new TraverseListener() { public void
* keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } });
*/
return m_Combo;
}
示例2: handleAddExceptionForControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void handleAddExceptionForControl(final Control control, final ValidationException e) {
if (control instanceof Text) {
Text text = (Text) control;
text.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
text.setToolTipText(e.getMessage());
} else if (control instanceof CCombo) {
CCombo combo = (CCombo) control;
combo.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
combo.setToolTipText(e.getMessage());
} else if (control instanceof Composite) {
Composite composite = (Composite) control;
composite.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
for (final Control childControl : composite.getChildren()) {
childControl.setBackground(new Color(control.getDisplay(), ERROR_COLOR));
}
composite.setToolTipText(e.getMessage());
}
}
示例3: handleRemoveExceptionForControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void handleRemoveExceptionForControl(final Control control) {
if (control instanceof Text) {
Text text = (Text) control;
text.setBackground(null);
text.setToolTipText(null);
} else if (control instanceof CCombo) {
CCombo combo = (CCombo) control;
combo.setBackground(null);
combo.setToolTipText(null);
} else if (control instanceof Composite) {
Composite composite = (Composite) control;
composite.setBackground(null);
for (final Control childControl : composite.getChildren()) {
childControl.setBackground(null);
}
composite.setToolTipText(null);
}
}
示例4: validateCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private boolean validateCombo(CCombo combo){
if((Arrays.asList(combo.getItems())).contains(combo.getText())){
combo.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
return true;
}else {
combo.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 244, 113));
return false;
}
}
示例5: initControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
@Override
protected void initControl() {
isReadOnly = (controlStyle & SWT.READ_ONLY) != 0;
// BUG in SWT: clear READ_ONLY bit since this does block the ProgressMonitorDialog
combo = new CCombo(parent, controlStyle | SWT.FLAT | SWT.SINGLE | SWT.BORDER) {
@Override
protected void checkSubclass() {
}
//
// public void setSelection(Point selection) {
// deselectAll();
// }
};
// combo = new CCombo(parent, controlStyle & ~SWT.READ_ONLY);
FontData[] fD = combo.getFont().getFontData();
fD[0].setHeight(DEFAULT_FONT_SIZE);
// combo.setFont(new Font(display,fD[0]));
combo.setFont(Fonts.createFont(fD[0]));
this.setControl(combo);
combo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setWidth(combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
}
});
combo.setEditable(false);
combo.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
combo.setListVisible(false);
// if (isReadOnly) {
// logger.debug("combo is read only!");
// combo.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
//
//
//
// combo.addKeyListener(new KeyListener() {
//
// @Override
// public void keyPressed(KeyEvent e) {
//
// e.doit=false;
// }
//
// @Override
// public void keyReleased(KeyEvent e) {
//
// e.doit=false;
// }
// });
// }
}
示例6: createCCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private static void createCCombo(final Group group) {
group.setLayout(new GridLayout(2, false));
group.setText("CCombo widget");
final Label lbl0 = new Label(group, SWT.NONE);
lbl0.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
lbl0.setText("No prompt :");
final CCombo combo0 = new CCombo(group, SWT.BORDER);
combo0.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
final Label lbl1 = new Label(group, SWT.NONE);
lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
lbl1.setText("Simple text prompt :");
final CCombo txt1 = new CCombo(group, SWT.BORDER);
txt1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
PromptSupport.setPrompt("Type anything you want", txt1);
final Label lbl2 = new Label(group, SWT.NONE);
lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
lbl2.setText("Other style (bold) :");
final CCombo txt2 = new CCombo(group, SWT.BORDER);
txt2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
PromptSupport.setPrompt("Type anything you want in bold", txt2);
PromptSupport.setFontStyle(SWT.BOLD, txt2);
final Label lbl3 = new Label(group, SWT.NONE);
lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
lbl3.setText("Behaviour highlight :");
final CCombo txt3 = new CCombo(group, SWT.BORDER);
txt3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
PromptSupport.setPrompt("Type anything you want", txt3);
PromptSupport.setFocusBehavior(FocusBehavior.HIGHLIGHT_PROMPT, txt3);
final Label lbl4 = new Label(group, SWT.NONE);
lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
lbl4.setText("Change colors :");
final CCombo txt4 = new CCombo(group, SWT.BORDER);
txt4.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
PromptSupport.setPrompt("Type anything you want", txt4);
PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW), txt4);
PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK), txt4);
final Label lbl5 = new Label(group, SWT.NONE);
lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
lbl5.setText("Change when widget is initialized :");
final CCombo txt5 = new CCombo(group, SWT.BORDER);
txt5.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
txt5.setText("Remove what is typed...");
txt5.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK));
txt5.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
PromptSupport.setPrompt("Type anything you want", txt5);
PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE), txt5);
PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_WHITE), txt5);
}