當前位置: 首頁>>代碼示例>>Java>>正文


Java CCombo.setBackground方法代碼示例

本文整理匯總了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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:21,代碼來源:KTableCellEditorCombo.java

示例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());
    }
  }
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:20,代碼來源:AbstractCustomPropertyField.java

示例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);
  }
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:19,代碼來源:AbstractCustomPropertyField.java

示例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;
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:10,代碼來源:FilterHelper.java

示例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;
//				}
//			});
//		}
	}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:57,代碼來源:ComboToolItem.java

示例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);

}
 
開發者ID:Haixing-Hu,項目名稱:swt-widgets,代碼行數:63,代碼來源:PromptSupportExample.java


注:本文中的org.eclipse.swt.custom.CCombo.setBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。