当前位置: 首页>>代码示例>>Java>>正文


Java Button类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Button的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Button类属于org.eclipse.swt.widgets包,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBottomControls

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
/**
 * Creates the bottom controls.
 */
private void createBottomControls(Composite parent) {
	Composite bottomControls = new Composite(parent, SWT.NONE);

	bottomControls
			.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.RIGHT, SWT.CENTER).create());
	bottomControls.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(0, 5, 0, 0).create());

	previewToggleButton = new Button(bottomControls, SWT.PUSH);
	previewToggleButton.setText(HIDE_PREVIEW_TEXT);
	previewToggleButton.setSelection(true);
	previewToggleButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.BOTTOM).create());
	previewToggleButton.setToolTipText(PREVIEW_BUTTON_TOOLTIP);

	previewToggleButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (!previewVisible) {
				showContentPreview();
			} else {
				hideContentPreview();
			}
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:PreviewableWizardPage.java

示例2: getTextBoxValue1Listener

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
/**
 * Gets the text box value 1 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 1 listener
 */
public  Listener getTextBoxValue1Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue1(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:32,代码来源:FilterHelper.java

示例3: mouseUp

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
	if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
		EnumValue val = new EnumValue();
		val.setName("");
		val.setComment("");
		val.setValnum("");
		getEnumArr().add(val);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
		int[] items = tabValues.getTable().getSelectionIndices();
		ArrayList<EnumValue> rem = new ArrayList<EnumValue>();
		for (int item : items) {
			rem.add(getEnumArr().get(item));
		}
		getEnumArr().removeAll(rem);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
		getEnumArr().clear();
		tabValues.refresh();
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:23,代码来源:EnumTypesPage.java

示例4: getTextBoxValue2Listener

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
/**
 * Gets the text box value 2 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 2 listener
 */
public  Listener getTextBoxValue2Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue2(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes,filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:32,代码来源:FilterHelper.java

示例5: mouseUp

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
	if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
		Parameter val = new Parameter();
		val.setName("");
		val.setType("");
		getParamArr().add(val);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
		int[] items = tabValues.getTable().getSelectionIndices();
		ArrayList<Parameter> rem = new ArrayList<Parameter>();
		for (int item : items) {
			rem.add(getParamArr().get(item));
		}
		getParamArr().removeAll(rem);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
		getParamArr().clear();
		tabValues.refresh();
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:22,代码来源:EventServicePage.java

示例6: createGroup

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
/**
 * This method initializes group	
 *
 */
private void createGroup() {
	GridData gridData1 = new GridData();
	gridData1.horizontalAlignment = GridData.BEGINNING;
	gridData1.grabExcessHorizontalSpace = true;
	gridData1.verticalAlignment = GridData.CENTER;
	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.verticalAlignment = GridData.CENTER;
	GridLayout gridLayout1 = new GridLayout();
	gridLayout1.numColumns = 2;
	GridData gridData3 = new GridData();
	gridData3.horizontalAlignment = GridData.FILL;
	gridData3.horizontalSpan = 2;
	gridData3.grabExcessHorizontalSpace = true;
	gridData3.grabExcessVerticalSpace = false;
	gridData3.verticalAlignment = GridData.FILL;
	group = new Group(this, SWT.NONE);
	group.setText("Target Server");
	group.setLayoutData(gridData3);
	group.setLayout(gridLayout1);
	label = new Label(group, SWT.NONE);
	label.setText("HTTP Server");
	httpServer = new Text(group, SWT.BORDER);
	httpServer.setLayoutData(gridData);
	
	label2 = new Label(group, SWT.NONE);
	label2.setText("HTTP Port");
	httpPort = new Text(group, SWT.BORDER);
	httpPort.setLayoutData(gridData1);
	label3 = new Label(group, SWT.NONE);
	label3.setText("SSL");
	ssl = new Button(group, SWT.CHECK);
	
	httpServer.addModifyListener(modifyListener);
       httpPort.addModifyListener(modifyListener);
       ssl.addSelectionListener(selectionListener);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:42,代码来源:NewProjectWizardComposite6.java

示例7: mouseUp

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
	if (e.getSource() instanceof Button) {
		Button sel = (Button) e.getSource();
		if (sel.getText().equalsIgnoreCase("Save")) {
			try {
				String tempText = util.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
				editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
				createPage1();
				setActivePage(1);
			} catch (JAXBException ex) {
				ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
			}
		}
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:TypesEditor.java

示例8: setupButtonGroup

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
private void
setupButtonGroup(
	final List<Button>		buttons )
{
	for ( final Button b: buttons ){

		b.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if ( !b.getSelection()){

					b.setSelection( true );
				}
				for ( Button b2: buttons ){

					if ( b2 != b ){
						b2.setSelection( false );
					}
				}
			}});
	}

	Utils.makeButtonsEqualWidth( buttons );
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:25,代码来源:BuddyPluginView.java

示例9: addImportSchemaButton

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
private void addImportSchemaButton(ELTSchemaSubgroupComposite buttonSubGroup) {

		importSchemaButton = new ELTDefaultButton("");
		SchemaButtonsSyncUtility.INSTANCE.buttonSize(importSchemaButton, macButtonWidth, macButtonHeight,
				windowButtonWidth, windowButtonHeight);
		buttonSubGroup.attachWidget(importSchemaButton);
		importSchemaButton.setImage(ImagePathConstant.IMPORT_SCHEMA_BUTTON);
		importSchemaButton.setToolTipText(Messages.IMPORT_SCHEMA_KEY_SHORTCUT_TOOLTIP);
		Button importButton = (Button) importSchemaButton.getSWTWidgetControl();
		importButton.addMouseListener(new MouseAdapter() {

			@Override
			public void mouseDown(MouseEvent e) {
				importSchema(importButton);
			}
		});
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:ELTSchemaGridWidget.java

示例10: getListener

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, final Widget... widgets) {
	final Button button = ((Button)widgets[0]);
	button.getShell();
	if(helpers != null){
		txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
		file_extension=(String)helpers.get(HelperType.FILE_EXTENSION);
	}
	
	Listener listener=new Listener() {
		@Override
		public void handleEvent(Event event) {
			if(event.type==SWT.Selection){
				FilterOperationClassUtility.INSTANCE.browseFile(file_extension,((Text) widgets[0]));
					propertyDialogButtonBar.enableApplyButton(true);
					txtDecorator.hide();
			}
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:ELTSchemaDialogSelectionListener.java

示例11: addSelectionListeneronButton

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
private void addSelectionListeneronButton(Button button, TableEditor editor) {
	button.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			ColorDialog dlg = new ColorDialog(Display.getCurrent().getActiveShell());
			dlg.setRGB(new RGB(0, 0, 0));
			RGB rgb = dlg.open();
			if (rgb != null) {
				Color color = new Color(shell.getDisplay(), rgb);
				String colorValue = convertRGBToHEX(rgb);
				editor.getItem().setText(1, colorValue);
				color.dispose();
			}
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:HeaderAndDataFormattingDialog.java

示例12: addRadioButton

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
protected void addRadioButton(Composite container) {
	Composite composite_1 = new Composite(container, SWT.NONE);
	composite_1.setLayout(new GridLayout(1, false));
	composite_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	xmlRadioButton = new Button(composite_1, SWT.RADIO);
	xmlRadioButton.setText("XML File");
	xmlRadioButton.setEnabled(true);
	xmlRadioButton.setSelection(true);
	
	xsdRadioButton = new Button(composite_1, SWT.RADIO);
	xsdRadioButton.setText("XSD File");
	
	addSelectionListenerOnXMLRadioBtn();
	addSelectionListenerOnXSDRadioBtn();
	
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:19,代码来源:SourceSelectionPage.java

示例13: attachRadioButtonToComposite

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
private void attachRadioButtonToComposite(Composite radioButtonsComposite) 
{
     expressionRadioButton=new Button(radioButtonsComposite, SWT.RADIO);
     if(OSValidator.isMac())
     {
	expressionRadioButton.setText(Messages.MAC_EXPRESSION_EDITIOR_LABEL);
  }
     else 
     {
    expressionRadioButton.setText(Messages.WINDOWS_EXPRESSION_EDITIOR_LABEL);
  }
     
     operationRadioButton = new Button(radioButtonsComposite, SWT.RADIO);
  operationRadioButton.setText(Messages.OPERATION_CALSS_LABEL);
  
  addSelectionListenerToExpressionRadioButton(expressionRadioButton);
  addSelectionListenerToOperationRadioButton(operationRadioButton);
  if(transformMapping.isExpression())
  {	  
  expressionRadioButton.setSelection(true);
  }
  else
  {	  
  operationRadioButton.setSelection(true);	  
  }
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:27,代码来源:OutputRecordCountWidget.java

示例14: getFieldNameModifyListener

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
/**
 * Gets the field name modify listener.
 * 
 * @param tableViewer
 *            the table viewer
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the field name modify listener
 */
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			int index = (int) source.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			String fieldName = source.getText();
			filterConditions.setFieldName(fieldName);
			
			if(StringUtils.isNotBlank(fieldName)){
				String fieldType = fieldsAndTypes.get(fieldName);
				TableItem item = tableViewer.getTable().getItem(index);
				CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
				if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
					conditionalCombo.setText(filterConditions.getConditionalOperator());
					conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
					new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
				}
			}
			validateCombo(source);
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:46,代码来源:FilterHelper.java

示例15: getListener

import org.eclipse.swt.widgets.Button; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar,ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;
			
	Listener listener=new Listener() { 
		@Override
		public void handleEvent(Event event) {
			if(!((Button)widgetList[1]).getSelection()){
			ControlDecoration	fieldNameMustJava = WidgetUtility.addDecorator((Text)widgetList[0],Messages.INVALID_FILE);
			if(!WidgetUtility.isFileExtention((((Text)widgetList[0]).getText()).trim(), ".java") && !(((Text)widgetList[0]).getText().trim().isEmpty())){
				fieldNameMustJava.show();
			((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
					255, 204));
			}
				else  
				{   
					((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
						255, 255));
				fieldNameMustJava.hide(); 
				}
			}
		} 
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:ELTCheckFileExtensionListener.java


注:本文中的org.eclipse.swt.widgets.Button类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。