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


Java Combo.setFont方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Combo.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.setFont方法的具體用法?Java Combo.setFont怎麽用?Java Combo.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.Combo的用法示例。


在下文中一共展示了Combo.setFont方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDestinationGroup

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Create the export destination specification widgets
 */
protected void createDestinationGroup(Composite parent) {
	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(
			GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText(getTargetLabel());
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
			| SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup,
			SWT.PUSH);
	destinationBrowseButton.setText(N4ExportMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	// new Label(parent, SWT.NONE); // vertical spacer
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:40,代碼來源:AbstractExportToSingleFileWizardPage.java

示例2: createDialogArea

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	boolean isWin32 = Util.isWindows();
	GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite);

	List<String> list = history.toList();
	String[] items = list.toArray(new String[list.size()]);
	
	Combo comboBox = SWTFactory.createCombo(composite, SWT.NONE, 2, items);
	Font terminalFont = JFaceResources.getTextFont();
	comboBox.setFont(terminalFont);
	
	GridData textLayoutData = new GridData();
	textLayoutData.horizontalAlignment = GridData.FILL;
	textLayoutData.verticalAlignment = GridData.FILL;
	textLayoutData.grabExcessHorizontalSpace = true;
	textLayoutData.grabExcessVerticalSpace = false;
	textLayoutData.horizontalSpan = 2;
	
	comboBox.setLayoutData(textLayoutData);
	
	comboBox.addKeyListener(new KeyAdapter() {
		
		@Override
		public void keyReleased(KeyEvent event) {
			if (event.character == '\r' ){
				inputText = comboBox.getText();
				if (inputText!=null){
					if (! inputText.equals(history.current())){
						/* when not same as current history entry, add it to history*/
						history.add(inputText);
					}
				}
				close();
			}
		}
	});
	return composite;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:41,代碼來源:QuickLaunchDialog.java

示例3: createGrammarsControls

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Creates the grammars controls.
 * 
 * @param composite
 *          the composite
 */
private void createGrammarsControls(final Composite composite) {
  Label generatorConfigLabel = new Label(composite, SWT.NONE);
  generatorConfigLabel.setText(Messages.GRAMMAR_FIELD_NAME_LABEL);

  Combo generatorConfigurationField = new Combo(composite, SWT.READ_ONLY);
  GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
  data.widthHint = PAGE_WIDTH_HINT; // prevents shrinking of combo view
  generatorConfigurationField.setLayoutData(data);
  generatorConfigurationField.setFont(composite.getFont());

  ComboViewer grammars = new ComboViewer(generatorConfigurationField);
  grammars.setContentProvider(new ArrayContentProvider());
  grammars.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(final Object object) {
      if (object instanceof Grammar) {
        return new GrammarHelper((Grammar) object).getLabelName();
      }
      return super.getText(object);
    }
  });
  grammars.setInput(resourceUtil.getGrammars());

  // React to the selection of the viewer
  // Note that the viewer return the real object and not just a string
  // representation
  grammars.addSelectionChangedListener(new ISelectionChangedListener() {
    public void selectionChanged(final SelectionChangedEvent event) {
      if (event.getSelection() instanceof StructuredSelection) {
        grammar = (Grammar) ((StructuredSelection) event.getSelection()).getFirstElement();
        grammarStatus = validateGrammarAccess();
        handleFieldChanged(GRAMMAR);
      }
    }
  });
  grammars.setSelection(null); // no pre-defined grammar to be used, forces the user to make a decision about which language to target
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:44,代碼來源:NewCheckCatalogWizardPage.java

示例4: createCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * This method is used to make a combo box
 * 
 * @param parent the parent composite to add the new combo to
 * @param style the style for the Combo
 * @param hspan the horizontal span to take up on the parent composite
 * @param fill how the combo will fill into the composite
 * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code>
 * @param items the item to put into the combo
 * @return a new Combo instance
 */
public static Combo createCombo(Composite parent, int style, int hspan, int fill, String[] items) {
	Combo c = new Combo(parent, style);
	c.setFont(parent.getFont());
	GridData gd = new GridData(fill);
	gd.horizontalSpan = hspan;
	c.setLayoutData(gd);
	if (items != null){
		c.setItems(items);
	}
	c.select(0);
	return c;
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:24,代碼來源:SWTFactory.java

示例5: createDestinationGroup

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Create the export destination specification widgets
 *
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 */
@SuppressWarnings("unused")
@Override
protected void createDestinationGroup(Composite parent) {

	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(
			GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText("npm Target Folder");
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
			| SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);
	BidiUtils.applyBidiProcessing(destinationNameField, StructuredTextTypeHandlerFactory.FILE);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup,
			SWT.PUSH);
	destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	new Label(parent, SWT.NONE); // vertical spacer
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:47,代碼來源:ExportSelectionPage.java

示例6: createCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * This method is used to make a combo box
 * 
 * @param parent
 *            the parent composite to add the new combo to
 * @param style
 *            the style for the Combo
 * @param hspan
 *            the horizontal span to take up on the parent composite
 * @param fill
 *            how the combo will fill into the composite Can be one of
 *            <code>GridData.FILL_HORIZONAL</code>,
 *            <code>GridData.FILL_BOTH</code> or
 *            <code>GridData.FILL_VERTICAL</code>
 * @param items
 *            the item to put into the combo
 * @return a new Combo instance
 */
public static Combo createCombo(Composite parent, int style, int hspan, int fill, String[] items) {
	Combo c = new Combo(parent, style);
	c.setFont(parent.getFont());
	GridData gd = new GridData(fill);
	gd.horizontalSpan = hspan;
	c.setLayoutData(gd);
	if (items != null) {
		c.setItems(items);
	}
	c.setVisibleItemCount(30);
	c.select(0);
	return c;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:32,代碼來源:SWTFactory.java


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