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

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

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

Button.addListener介绍

暂无

代码示例

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

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

formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
shell.setText( title );
 wOK = new Button( shell, SWT.PUSH );
 wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
 wCancel = new Button( shell, SWT.PUSH );
 wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
 wOK.addListener( SWT.Selection, lsOK );
 wCancel.addListener( SWT.Selection, lsCancel );
} else {
 wOK = new Button( shell, SWT.PUSH );
 wOK.setText( BaseMessages.getString( PKG, "System.Button.Close" ) );
 wOK.addListener( SWT.Selection, lsOK );
shell.open();
while ( !shell.isDisposed() ) {
 if ( !display.readAndDispatch() ) {

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

formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
wOK = new Button( shell, SWT.PUSH );
wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
wRefresh = new Button( shell, SWT.PUSH );
wRefresh.setText( BaseMessages.getString( PKG, "System.Button.Refresh" ) );
wCancel = new Button( shell, SWT.PUSH );
wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
wCancel.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  dispose();
wOK.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  handleOK();
wRefresh.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  getData();
shell.open();
Display display = parent.getDisplay();
while ( !shell.isDisposed() ) {

代码示例来源: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();
shell.open();

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

shell.setLayout( new FormLayout() );
shell.setText( title );
props.setLook( shell );
Label wlMessage = new Label( shell, SWT.FLAT  | SWT.WRAP );
wlMessage.setText( message );
FormData fdMessage = new FormData();
fdMessage.left = new FormAttachment( wlImage, 15, SWT.RIGHT );
wlMessage.setLayoutData( fdMessage );
props.setLook( wlMessage );
Button spacer = new Button( shell, SWT.NONE );
 Button wButton = new Button( shell, SWT.PUSH );
 wButton.setText( label );
 wButton.setLayoutData( fdButton );
 wButton.addListener( SWT.Selection, listenAndDispose( listenerMap.get( label ) ) );
 props.setLook( wButton );
 attachTo = wButton;
shell.open();
while ( !shell.isDisposed() ) {
 if ( !display.readAndDispatch() ) {

代码示例来源: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 );
 fdGetFields.right = new FormAttachment( 100, 0 );
 wGetFields.setLayoutData( fdGetFields );
 Button wDoMapping = new Button( shell, SWT.PUSH );
 wDoMapping.setText( BaseMessages.getString( PKG, "IngresVectorWiseLoaderDialog.DoMapping.Button" ) );
 FormData fdDoMapping = new FormData();
 fdDoMapping.top = new FormAttachment( wGetFields, margin );
 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: pentaho/pentaho-kettle

formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
shell.setText( title );
wOK = new Button( shell, SWT.PUSH );
wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
wOK.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  ok();
wCancel = new Button( shell, SWT.PUSH );
wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
wCancel.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  cancel();
shell.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: pentaho/pentaho-kettle

props.setLook( wFieldsComp );
wGet = new Button( wFieldsComp, SWT.PUSH );
wGet.setText( BaseMessages.getString( PKG, "System.Button.GetFields" ) );
wGet.setToolTipText( BaseMessages.getString( PKG, "System.Tooltip.GetFields" ) );
wGet.addListener( SWT.Selection, lsGet );
fdFields.left = new FormAttachment( 0, Const.MARGIN );
fdFields.top = new FormAttachment( 0, Const.MARGIN );
fdFields.right = new FormAttachment( 100, -Const.MARGIN );
fdFields.bottom = new FormAttachment( wGet, -Const.MARGIN );
wFields.setLayoutData( fdFields );

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

sShell.setSize( new Point( 360, 126 ) );
FormLayout formLayout = new FormLayout();
sShell.setLayout( formLayout );
btnNext.setLayoutData( frmData );
btnCancel = new Button( sShell, SWT.PUSH );
btnCancel.setText( BaseMessages.getString( PKG, "Widget.Styled.Comp.Close" ) );
btnCancel.setLayoutData( frmData );
btnIgnoreCase = new Button( sShell, SWT.CHECK );
btnIgnoreCase.setText( BaseMessages.getString( PKG, "Widget.Styled.Comp.CaseSensitive" ) );
grpDir.setLayoutData( frmData );
btnNext.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  if ( !findText() ) {
btnCancel.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  sShell.dispose();
sShell.open();
Display display = parent.getDisplay();
while ( !parent.isDisposed() && !sShell.isDisposed() && !text.isDisposed() ) {

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

FormData fdlStep, fdStep1;
wlStep = new Label( shell, SWT.LEFT );
wlStep.setLayoutData( fdlStep );
wInputStepArray[index] = new CCombo( shell, SWT.BORDER );
props.setLook( wInputStepArray[index] );
wInputStepArray[index].setLayoutData( fdStep1 );
Label keyLabel = new Label( shell, SWT.LEFT );
keyLabel.setText( BaseMessages.getString( PKG, "MultiMergeJoinMeta.JoinKeys" ) );
props.setLook( keyLabel );
FormData keyStep = new FormData();
 keyStep.top = new FormAttachment( wInputStepArray[index - 1], margin );
keyLabel.setLayoutData( keyStep );
Button button = new Button( shell, SWT.PUSH );
button.setText( BaseMessages.getString( PKG, "MultiMergeJoinMeta.SelectKeys" ) );
 .addListener( SWT.Selection, new ConfigureKeyButtonListener( this, keyValTextBox[index], index, lsMod ) );
FormData buttonData = new FormData();
buttonData.left = new FormAttachment( 65, margin );

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

formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
wOK = new Button( shell, SWT.PUSH );
wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
wCancel = new Button( shell, SWT.PUSH );
wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
fdCond.left = new FormAttachment( 0, 0 ); // To the right of the label
fdCond.top = new FormAttachment( 0, 0 );
fdCond.right = new FormAttachment( 100, 0 );
fdCond.bottom = new FormAttachment( 100, -50 );
wCond.setLayoutData( fdCond );
wCancel.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  condition = null;
wOK.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  handleOK();
shell.open();
Display display = parent.getDisplay();
while ( !shell.isDisposed() ) {

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

wTestCl = new Button( wServersComp, SWT.PUSH );
wTestCl.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestCluster.Label" ) );
wTestCl.setToolTipText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestCluster.Tooltip" ) );
wTestCl.addListener( SWT.Selection, new Listener() {
        props );
FormData fdServers = new FormData();
fdServers.left = new FormAttachment( 0, Const.MARGIN );
fdServers.top = new FormAttachment( 0, Const.MARGIN );
fdServers.right = new FormAttachment( 100, -Const.MARGIN );
fdServers.bottom = new FormAttachment( wTestCl, -Const.MARGIN );
wServers.setLayoutData( fdServers );

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

formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
shell.setImage( GUIResource.getInstance().getImageSpoon() );
shell.setText( BaseMessages.getString( PKG, "KettleFileRepositoryDialog.Dialog.Main.Title2" ) );
wbBaseDir = new Button( shell, SWT.PUSH );
wbBaseDir.setText( BaseMessages.getString( PKG, "System.Button.Browse" ) );
fdbBaseDir.right = new FormAttachment( 100, 0 );
fdbBaseDir.top = new FormAttachment( 0, margin );
wbBaseDir.setLayoutData( fdbBaseDir );
props.setLook( wBaseDir );
fdBaseDir = new FormData();
fdBaseDir.left = new FormAttachment( middle, 0 );
wlBaseDir.setLayoutData( fdlBaseDir );
wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
lsOK = new Listener() {
 public void handleEvent( Event e ) {
wOK.addListener( SWT.Selection, lsOK );
wCancel.addListener( SWT.Selection, lsCancel );

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

protected void addFileWidgets() {
 Label wlLocation = new Label( this, SWT.RIGHT );
 wlLocation.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Location.Label" ) );
 wlLocation.setLayoutData( new FormDataBuilder( ).left( 0, 0 ).top( 0, 0 ).result() );
 wLocation = new CCombo( this, SWT.BORDER | SWT.READ_ONLY );
 List<VFSScheme> availableVFSSchemes = getAvailableVFSSchemes();
  new FormDataBuilder().left( 0, 0 ).top( wlLocation, FIELD_LABEL_SEP ).width( FIELD_SMALL ).result() );
 Label wlPath = new Label( this, SWT.RIGHT );
 wlPath.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Filename.Label" ) );
 wlPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wLocation, FIELDS_SEP ).result() );
 wPath = new TextVar( space, this, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
 wPath.addModifyListener( lsMod );
 wPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wlPath, FIELD_LABEL_SEP ).width( FIELD_LARGE + VAR_EXTRA_WIDTH ).result() );
 wbBrowse = new Button( this, SWT.PUSH );
 wbBrowse.setText( BaseMessages.getString( PKG, "System.Button.Browse" ) );
 wbBrowse.addListener( SWT.Selection, event -> browseForFileInputPath() );
 int bOffset = ( wbBrowse.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y
  - wPath.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y ) / 2;

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

formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
shell.setText( dialogTitle );
wClose = new Button( shell, SWT.PUSH );
wClose.setText( BaseMessages.getString( PKG, "System.Button.Close" ) );
wClose.addListener( SWT.Selection, new Listener() {
 public void handleEvent( Event e ) {
  close();
shell.open();

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

protected Button buildCancelButton() {
 wCancel = new Button( shell, SWT.PUSH );
 wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) ); //$NON-NLS-1$
 wCancel.setLayoutData( new FormDataBuilder().bottom().right( 100, 0 ).result() );
 wCancel.addListener( SWT.Selection, lsCancel );
 return wCancel;
}

相关文章

Button类方法