org.eclipse.swt.widgets.Button.setLayoutData()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(13.2k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.eclipse.swt.widgets.Button.setLayoutData()方法的一些代码示例,展示了Button.setLayoutData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setLayoutData()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Button
类名称:Button
方法名:setLayoutData

Button.setLayoutData介绍

暂无

代码示例

代码示例来源: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

/**
 * 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

@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: caoxinyu/RedisClient

composite.setLayout(new GridLayout(2, false));
btnExpire = new Button(composite, SWT.CHECK);
btnExpire.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
btnExpire.setText(RedisClient.i18nFile.getText(I18nFile.EXPIRE));
labelTTL = new Label(composite, SWT.NONE);
labelTTL.setEnabled(false);
labelTTL.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
labelTTL.setText(RedisClient.i18nFile.getText(I18nFile.TTLS));

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * @param factory
 *          factory to use.
 */
protected void buildVariableSubstitutionLine( final PluginWidgetFactory factory ) {
 final Control topControl = this.wControlFile;
 this.wlVariableSubstitution =
  factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.VariableSubstitution.Label" ) );
 this.props.setLook( this.wlVariableSubstitution );
 this.wlVariableSubstitution.setLayoutData( factory.createLabelLayoutData( topControl ) );
 this.wVariableSubstitution = new Button( this.shell, SWT.CHECK );
 this.props.setLook( this.wVariableSubstitution );
 this.wVariableSubstitution.setLayoutData( factory.createControlLayoutData( topControl ) );
}

代码示例来源: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() {
  @Override public void widgetSelected( SelectionEvent selectionEvent ) {
 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: caoxinyu/RedisClient

ttlComposite.setLayout(new GridLayout(2, false));
btnExpire = new Button(ttlComposite, SWT.CHECK);
btnExpire.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
btnExpire.setText(RedisClient.i18nFile.getText(I18nFile.EXPIRE));
labelTTL = new Label(ttlComposite, SWT.NONE);
labelTTL.setEnabled(false);
labelTTL.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
labelTTL.setText(RedisClient.i18nFile.getText(I18nFile.TTLS));

代码示例来源: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

/**
 * 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: pentaho/pentaho-kettle

/**
 * @param factory
 *          factory to use.
 */
protected void buildTruncateTableLine( final PluginWidgetFactory factory ) {
 final Control topControl = this.wTable;
 this.wlTruncateTable =
  factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.TruncateTable.Label" ) );
 this.props.setLook( this.wlTruncateTable );
 this.wlTruncateTable.setLayoutData( factory.createLabelLayoutData( topControl ) );
 this.wbTruncateTable = new Button( this.shell, SWT.CHECK );
 this.props.setLook( this.wbTruncateTable );
 this.wbTruncateTable.setLayoutData( factory.createControlLayoutData( topControl ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

for ( JmsProvider.ConnectionType type : JmsProvider.ConnectionType.values() ) {
 Button connectionButton = new Button( wConnectionGroup, SWT.RADIO );
 connectionButton.setText( type.toString() );
 FormData fdbConnType = new FormData();
 fdbConnType.left = new FormAttachment( 0, 0 );
 if ( previous == null ) {
  fdbConnType.top = new FormAttachment( 0, 0 );
 } else {
  fdbConnType.top = new FormAttachment( previous, 10 );
 connectionButton.setLayoutData( fdbConnType );
Label environmentSeparator = new Label( wConnectionGroup, SWT.SEPARATOR | SWT.VERTICAL );
FormData fdenvironmentSeparator = new FormData();
fdenvironmentSeparator.top = new FormAttachment( 0, 0 );
fdenvironmentSeparator.left = new FormAttachment( widestWidget, 15 );
fdenvironmentSeparator.bottom = new FormAttachment( 100, 0 );
environmentSeparator.setLayoutData( fdenvironmentSeparator );

代码示例来源:origin: caoxinyu/RedisClient

public UpdateTTLTabItem(TabFolder parent, final int id, final int db, final String key) {
  super(parent);
  new Label(composite, SWT.NONE);
  btnApplyButton = new Button(composite, SWT.NONE);
  btnApplyButton.addSelectionListener(new SelectionAdapter() {
    @Override
  btnApplyButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
  btnApplyButton.setText(RedisClient.i18nFile.getText(I18nFile.APPLY));
  btnApplyButton.setEnabled(false);

代码示例来源: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

/**
 * 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();
  }
 } );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * @param factory
 *          factory to use.
 */
protected void buildUseControlFileLine( final PluginWidgetFactory factory ) {
 final Control topControl = this.wStepname;
 this.wlUseControlFile =
  factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.UseControlFile.Label" ) );
 this.props.setLook( this.wlUseControlFile );
 this.wlUseControlFile.setLayoutData( factory.createLabelLayoutData( topControl ) );
 this.wUseControlFile = new Button( this.shell, SWT.CHECK );
 this.props.setLook( this.wUseControlFile );
 this.wUseControlFile.setLayoutData( factory.createControlLayoutData( topControl ) );
 this.wUseControlFile.addSelectionListener( new SelectionAdapter() {
  @Override
  public void widgetSelected( final SelectionEvent event ) {
   disableInputs();
  }
 } );
}

代码示例来源:origin: pentaho/pentaho-kettle

wlUsername = new Label( composite, SWT.RIGHT );
wlUsername.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPage2.Username.Label" ) );
props.setLook( wlUsername );
fdlUsername = new FormData();
fdlUsername.top = new FormAttachment( 0, 0 );
fdlUsername.left = new FormAttachment( 0, 0 );
fdlUsername.right = new FormAttachment( middle, 0 );
wlUsername.setLayoutData( fdlUsername );
wUsername = new Text( composite, SWT.SINGLE | SWT.BORDER );
props.setLook( wUsername );
fdUsername = new FormData();
wlPassword = new Label( composite, SWT.RIGHT );
wlPassword.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPage2.Password.Label" ) );
props.setLook( wlPassword );
fdlPassword = new FormData();
wlPassword.setLayoutData( fdlPassword );
wPassword = new Text( composite, SWT.SINGLE | SWT.BORDER );
props.setLook( wPassword );
wTest = new Button( composite, SWT.PUSH );
wTest.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPage2.TestConnection.Button" ) );
wTest.setLayoutData( fdTest );
wTest.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent arg0 ) {

代码示例来源: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

public Composite createContent( String radioText ) {
 Control[] existingButtons = radioGroup.getChildren();
 Button button = new Button( radioGroup, SWT.RADIO );
 button.setText( radioText );
 props.setLook( button );
 FormData fdButton = new FormData();
 fdButton.top = new FormAttachment( 0 );
 fdButton.left = existingButtons.length == 0
  ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[existingButtons.length - 1], 40 );
 button.setLayoutData( fdButton );
 button.setSelection( existingButtons.length == 0 );
 Composite content = new Composite( contentArea, SWT.NONE );
 content.setVisible( existingButtons.length == 0 );
 props.setLook( content );
 content.setLayout( noMarginLayout );
 content.setLayoutData( fdMaximize );
 button.addSelectionListener( new SelectionAdapter() {
  @Override public void widgetSelected( SelectionEvent selectionEvent ) {
   for ( Control control : contentArea.getChildren() ) {
    control.setVisible( false );
   }
   content.setVisible( true );
  }
 } );
 return content;
}

代码示例来源: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

FormData fd_alwaysShowOption = new FormData();
fd_alwaysShowOption.left = new FormAttachment( 0, 15 );
fd_alwaysShowOption.top = new FormAttachment( tabFolder, 15 );
alwaysShowOption.setLayoutData( fd_alwaysShowOption );
alwaysShowOption.setText( BaseMessages.getString( PKG, prefix + ".AlwaysOption.Value" ) );
wCancel = new Button( shell, SWT.PUSH );
FormData fd_wCancel = new FormData();
fd_wCancel.bottom = new FormAttachment( 100, -15 );
wCancel.setLayoutData( fd_wCancel );
wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
wCancel.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
wOK.setLayoutData( fd_wOK );
wOK.setText( BaseMessages.getString( PKG, prefix + ".Button.Launch" ) );
wOK.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
btnHelp.setLayoutData( fd_btnHelp );
btnHelp.addSelectionListener( new SelectionAdapter() {
 @Override
Label separator = new Label( shell, SWT.SEPARATOR | SWT.HORIZONTAL );
separator.setLayoutData( fd_separator );

相关文章

Button类方法