本文整理了Java中org.eclipse.swt.widgets.Button.<init>()
方法的一些代码示例,展示了Button.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.<init>()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Button
类名称:Button
方法名:<init>
[英]Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
The style value is either one of the style constants defined in class SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
[中]给定该类的父类和描述其行为和外观的样式值,构造该类的新实例。
样式值是类SWT
中定义的一个样式常量,适用于该类的实例,或者必须通过按位或将两个或多个SWT
样式常量(即,使用int
“|”运算符)组合在一起来生成。类描述列出了适用于该类的样式常量。样式位也继承自超类。
代码示例来源:origin: pentaho/pentaho-kettle
/**
* @param style
* style to use.
* @param text
* text to set.
* @return new button.
*/
public Button createButton( final int style, final String text ) {
final Button button = new Button( this.shell, style );
button.setText( text );
return button;
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* build Ok Button.
*/
protected void buildOkButton() {
Button ok = new Button( this.dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "TeraFastDialog.About.Plugin.Close" ) );
GridData grdData = new GridData( GridData.HORIZONTAL_ALIGN_CENTER );
grdData.horizontalSpan = 2;
grdData.verticalIndent = DEFAULT_INDENT;
grdData.horizontalIndent = DEFAULT_INDENT;
ok.setLayoutData( grdData );
ok.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event arg0 ) {
dialog.dispose();
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void setCloseButton() {
closeButton = new Button( shell, SWT.PUSH );
closeButton.setText( BaseMessages.getString( PKG, "System.Button.Close" ) );
FormData fdbutton = new FormData();
fdbutton.right = new FormAttachment( 100, 0 ); //Button should below the link and separated by 30
fdbutton.top = new FormAttachment( link, padding );
fdbutton.height = padding;
closeButton.setLayoutData( fdbutton );
props.setLook( closeButton );
// Add listeners
closeButton.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
close();
}
} );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
protected Control addAdditionalComponentIfNeed( int middle, int margin, Composite wFileComp, Composite topComp ) {
// Run this as a command instead?
wlFileIsCommand = new Label( wFileComp, SWT.RIGHT );
wlFileIsCommand
.setText( BaseMessages.getString( textFileOutputLegacyMetaClass, "TextFileOutputLegacyDialog.FileIsCommand.Label" ) );
props.setLook( wlFileIsCommand );
fdlFileIsCommand = new FormData();
fdlFileIsCommand.left = new FormAttachment( 0, 0 );
fdlFileIsCommand.top = new FormAttachment( topComp, margin );
fdlFileIsCommand.right = new FormAttachment( middle, -margin );
wlFileIsCommand.setLayoutData( fdlFileIsCommand );
wFileIsCommand = new Button( wFileComp, SWT.CHECK );
props.setLook( wFileIsCommand );
fdFileIsCommand = new FormData();
fdFileIsCommand.left = new FormAttachment( middle, 0 );
fdFileIsCommand.top = new FormAttachment( topComp, margin );
fdFileIsCommand.right = new FormAttachment( 100, 0 );
wFileIsCommand.setLayoutData( fdFileIsCommand );
wFileIsCommand.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
input.setChanged();
enableParentFolder();
}
} );
return wlFileIsCommand;
}
代码示例来源:origin: pentaho/pentaho-kettle
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
rule = (DatabaseConfigurationImportRule) importRule;
databaseMeta = rule.getDatabaseMeta();
PropsUI props = PropsUI.getInstance();
composite = new Composite( parent, SWT.NONE );
props.setLook( composite );
composite.setLayout( new FillLayout() );
label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
props.setLook( label );
label.setText( "Database configuration : (not configured)" );
button = new Button( composite, SWT.PUSH );
button.setText( "Edit..." );
button.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent event ) {
editDatabase();
}
} );
return composite;
}
代码示例来源:origin: pentaho/pentaho-kettle
public void widgetSelected( SelectionEvent e ) {
final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) );
dialog.setImage( GUIResource.getInstance().getImageSpoon() );
dialog.setLayout( new GridLayout( 3, false ) );
final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
new Label( dialog, SWT.NONE );
new Label( dialog, SWT.NONE );
Button ok = new Button( dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
ok.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
Calendar cal = Calendar.getInstance();
cal.set( Calendar.YEAR, calendar.getYear() );
cal.set( Calendar.MONTH, calendar.getMonth() );
cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
cal.set( Calendar.MINUTE, time.getMinutes() );
cal.set( Calendar.SECOND, time.getSeconds() );
wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) );
dialog.close();
}
} );
dialog.setDefaultButton( ok );
dialog.pack();
dialog.open();
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
Label lIcon = new Label( shell, SWT.RIGHT );
lIcon.setLayoutData( new FormDataBuilder().right().result() );
lIcon.setImage( JobDialog.getImage( shell, JobDialog.getPlugin( getEntry() ) ) );
wCancel = new Button( shell, SWT.PUSH );
wCancel.setText( systemMessages.getString( "Button.Cancel" ) );
wCancel.setLayoutData( new FormDataBuilder().bottom().right().width( BUTTON_WIDTH ).result() );
wOK = new Button( shell, SWT.PUSH );
wOK.setText( systemMessages.getString( "Button.OK" ) );
wOK.setLayoutData( new FormDataBuilder().bottom().right( wCancel, -ConstUI.SMALL_MARGIN ).width( BUTTON_WIDTH )
.result() );
wCancel.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
cancel();
wOK.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
ok();
代码示例来源:origin: pentaho/pentaho-kettle
public CheckBox( Composite composite ) {
super( composite, SWT.NONE );
WidgetUtils.setFormLayout( this, 0 );
button = new Button( this, SWT.CHECK );
button.setLayoutData( new FormDataBuilder().left().result() );
label = new Label( this, SWT.LEFT );
label.setLayoutData( new FormDataBuilder().left( button, ConstUI.SMALL_MARGIN ).result() );
}
代码示例来源:origin: pentaho/pentaho-kettle
protected Button buildGetFieldsButton( final Composite parent, final SelectionAdapter listener ) {
// get fields button
wGet = new Button( parent, SWT.PUSH );
updateGetFieldsButtonStatus();
wGet.setText( BaseMessages.getString( PKG, "CommonStepDialog.Button.GetFields" ) ); //$NON-NLS-1$
props.setLook( wGet );
wGet.setLayoutData( new FormDataBuilder().right( 100, 0 ).bottom( 100, 0 ).result() );
wGet.addSelectionListener( listener );
return wGet;
}
代码示例来源:origin: pentaho/pentaho-kettle
private void buildWidget() {
wCheckBox = new Button( parentComposite, SWT.CHECK );
wCheckBox.setText( buttonName );
props.setLook( wCheckBox );
FormData fdUseSSL = new FormData();
fdUseSSL.top = new FormAttachment( parentComposite, 0 );
fdUseSSL.left = new FormAttachment( 0, 0 );
wCheckBox.setLayoutData( fdUseSSL );
wCheckBox.addSelectionListener( new SelectionListener() {
Label wlSSLProperties = new Label( parentComposite, SWT.LEFT );
wlSSLProperties.setText( tableName );
props.setLook( wlSSLProperties );
FormData fdlSSLProperties = new FormData();
fdlSSLProperties.top = new FormAttachment( wCheckBox, 10 );
fdlSSLProperties.left = new FormAttachment( 0, 0 );
wlSSLProperties.setLayoutData( fdlSSLProperties );
代码示例来源:origin: pentaho/pentaho-kettle
check = new Button( parent, SWT.CHECK );
check.setText( "Stack" );
check.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
toggleStackTrace();
start = new Button( parent, SWT.PUSH );
start.setText( "Snap" );
start.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event event ) {
refreshAll();
stop = new Button( parent, SWT.PUSH );
stop.setText( "Diff" );
stop.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event event ) {
refreshDifference();
label = new Label( parent, SWT.BORDER );
label.setText( "0 object(s)" );
parent.addListener( SWT.Resize, new Listener() {
public void handleEvent( Event e ) {
代码示例来源:origin: pentaho/pentaho-kettle
protected Button createSettingsButton( Composite p, String text, String title, Control top, SelectionAdapter sa ) {
Button button = new Button( p, SWT.CHECK );
button.setText( BaseMessages.getString( PKG, text ) );
button.setToolTipText( BaseMessages.getString( PKG, title ) );
props.setLook( button );
FormData fd = new FormData();
fd.left = new FormAttachment( 0, Const.MARGIN * 2 );
if ( top == null ) {
fd.top = new FormAttachment( 0, 10 );
} else {
fd.top = new FormAttachment( top, 5 );
}
fd.right = new FormAttachment( 100, 0 );
button.setLayoutData( fd );
button.addSelectionListener( sa );
return button;
}
代码示例来源:origin: pentaho/pentaho-kettle
public void widgetSelected( SelectionEvent e ) {
final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
dialog.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) );
dialog.setImage( GUIResource.getInstance().getImageSpoon() );
dialog.setLayout( new GridLayout( 3, false ) );
final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
new Label( dialog, SWT.NONE );
new Label( dialog, SWT.NONE );
Button ok = new Button( dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
ok.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
Calendar cal = Calendar.getInstance();
cal.set( Calendar.YEAR, calendar.getYear() );
cal.set( Calendar.MONTH, calendar.getMonth() );
cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
cal.set( Calendar.MINUTE, time.getMinutes() );
cal.set( Calendar.SECOND, time.getSeconds() );
wReadFrom.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) );
dialog.close();
}
} );
dialog.setDefaultButton( ok );
dialog.pack();
dialog.open();
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
/**
* build Ok Button.
*/
protected void buildOkButton() {
Button ok = new Button( this.dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "OlapInputDialog.About.Plugin.Close" ) );
GridData grdData = new GridData( GridData.HORIZONTAL_ALIGN_CENTER );
grdData.horizontalSpan = 2;
grdData.verticalIndent = DEFAULT_INDENT;
grdData.horizontalIndent = DEFAULT_INDENT;
ok.setLayoutData( grdData );
ok.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event arg0 ) {
dialog.dispose();
}
} );
}
代码示例来源:origin: caoxinyu/RedisClient
protected void initContents() {
Composite composite_1 = new Composite(shell, SWT.NONE);
composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));
composite_1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
false, 1, 1));
btnOk = new Button(composite_1, SWT.NONE);
btnOk.addSelectionListener(okSelection);
btnOk.setText(RedisClient.i18nFile.getText(I18nFile.OK));
Button btnCancel = new Button(composite_1, SWT.NONE);
btnCancel.addSelectionListener(cancelSelection);
btnCancel.setText(RedisClient.i18nFile.getText(I18nFile.CANCEL));
}
代码示例来源:origin: pentaho/pentaho-kettle
private Control addFieldSelection( Control lastControl ) {
UpInsRows, lsMod, props );
Button wGetFields = new Button( shell, SWT.PUSH );
wGetFields.setText( BaseMessages.getString( PKG, "IngresVectorWiseLoaderDialog.GetFields.Button" ) );
FormData fdGetFields = new FormData();
fdGetFields.top = new FormAttachment( wlFields, margin );
Button wDoMapping = new Button( shell, SWT.PUSH );
wDoMapping.setText( BaseMessages.getString( PKG, "IngresVectorWiseLoaderDialog.DoMapping.Button" ) );
FormData fdDoMapping = new FormData();
wDoMapping.setLayoutData( fdDoMapping );
wGetFields.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
get();
wDoMapping.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event arg0 ) {
generateMappings();
代码示例来源:origin: caoxinyu/RedisClient
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
Label lblNewLabel = new Label(composite, SWT.WRAP);
lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblNewLabel.setText(RedisClient.i18nFile.getText(I18nFile.DONATIONMESSAGE));
Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
label.setAlignment(SWT.CENTER);
label.setImage(code);
composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));
Button btnOk = new Button(composite_1, SWT.NONE);
btnOk.addSelectionListener(new SelectionAdapter() {
@Override
btnOk.setText(RedisClient.i18nFile.getText(I18nFile.OK));
代码示例来源:origin: pentaho/pentaho-kettle
private static Button newButton( final Composite parent ) {
Button button = new Button( parent, SWT.PUSH );
button.setImage( GUIResource.getInstance().getImageHelpWeb() );
button.setText( BaseMessages.getString( PKG, "System.Button.Help" ) );
button.setToolTipText( BaseMessages.getString( PKG, "System.Tooltip.Help" ) );
FormData fdButton = new FormData();
fdButton.left = new FormAttachment( 0, 0 );
fdButton.bottom = new FormAttachment( 100, 0 );
button.setLayoutData( fdButton );
return button;
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent e ) {
final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
dialog.setText( BaseMessages.getString( PKG, "SalesforceInputDialog.SelectDate" ) );
dialog.setImage( GUIResource.getInstance().getImageSpoon() );
dialog.setLayout( new GridLayout( 3, false ) );
new Label( dialog, SWT.NONE );
new Label( dialog, SWT.NONE );
Button ok = new Button( dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
ok.addSelectionListener( new SelectionAdapter() {
代码示例来源:origin: pentaho/pentaho-kettle
/**
* build Ok Button.
*/
protected void buildOkButton() {
Button ok = new Button( this.dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "SapInputDialog.About.Plugin.Close" ) );
GridData grdData = new GridData( GridData.HORIZONTAL_ALIGN_CENTER );
grdData.horizontalSpan = 2;
grdData.verticalIndent = DEFAULT_INDENT;
grdData.horizontalIndent = DEFAULT_INDENT;
ok.setLayoutData( grdData );
ok.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event arg0 ) {
dialog.dispose();
}
} );
}
内容来源于网络,如有侵权,请联系作者删除!