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

x33g5p2x  于2022-01-29 转载在 其他  
字(12.8k)|赞(0)|评价(0)|浏览(112)

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

Shell.setImage介绍

暂无

代码示例

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

protected void mainLayout( Class<?> PKG, String prefix, Image img ) {
 display = parent.getDisplay();
 shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL );
 props.setLook( shell );
 shell.setImage( img );
 shell.setLayout( new FormLayout() );
 shell.setText( BaseMessages.getString( PKG, prefix + ".Shell.Title" ) );
}

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

public void setShellImage( Shell shell, StepMetaInterface stepMetaInterface ) {
 try {
  String id = PluginRegistry.getInstance().getPluginId( StepPluginType.class, stepMetaInterface );
  if ( getShell() != null && id != null ) {
   getShell().setImage( GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmap( shell.getDisplay() ) );
  }
 } catch ( Throwable e ) {
  // Ignore
 }
}

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

private void setShellImage( Shell shell ) {
 if ( stepMeta != null ) {
  PluginInterface plugin =
   PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  createHelpButton( shell, stepMeta, plugin );
  String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
   shell.setImage( GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize(
    shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ) );
  }
 }
}

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

public void widgetSelected( SelectionEvent e ) {
  final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM );
  dialogto.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) );
  dialogto.setImage( GUIResource.getInstance().getImageSpoon() );
  dialogto.setLayout( new GridLayout( 3, false ) );
  final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER );
  final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME );
  new Label( dialogto, SWT.NONE );
  new Label( dialogto, SWT.NONE );
  Button okto = new Button( dialogto, SWT.PUSH );
  okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  okto.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendarto.getYear() );
    cal.set( Calendar.MONTH, calendarto.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() );
    cal.set( Calendar.MINUTE, timeto.getMinutes() );
    cal.set( Calendar.SECOND, timeto.getSeconds() );
    wReadTo.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) );
    dialogto.close();
   }
  } );
  dialogto.setDefaultButton( okto );
  dialogto.pack();
  dialogto.open();
 }
} );

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

public void widgetSelected( SelectionEvent e ) {
  final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM );
  dialogto.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) );
  dialogto.setImage( GUIResource.getInstance().getImageSpoon() );
  dialogto.setLayout( new GridLayout( 3, false ) );
  final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER );
  final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME );
  new Label( dialogto, SWT.NONE );
  new Label( dialogto, SWT.NONE );
  Button okto = new Button( dialogto, SWT.PUSH );
  okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  okto.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendarto.getYear() );
    cal.set( Calendar.MONTH, calendarto.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() );
    cal.set( Calendar.MINUTE, timeto.getMinutes() );
    cal.set( Calendar.SECOND, timeto.getSeconds() );
    wReadTo.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) );
    dialogto.close();
   }
  } );
  dialogto.setDefaultButton( okto );
  dialogto.pack();
  dialogto.open();
 }
} );

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

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

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 ) );

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

final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM );
dialogto.setText( BaseMessages.getString( PKG, "SalesforceInputDialog.SelectDate" ) );
dialogto.setImage( GUIResource.getInstance().getImageSpoon() );
dialogto.setLayout( new GridLayout( 3, false ) );

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

public static final Button setShellImage( Shell shell, JobEntryInterface jobEntryInterface ) {
 Button helpButton = null;
 try {
  final PluginInterface plugin = getPlugin( jobEntryInterface );
  if ( plugin.getCategory().equals( BaseMessages.getString( PKGBASE, "JobCategory.Category.Deprecated" ) ) ) {
   addDeprecation( shell );
  }
  helpButton = HelpUtils.createHelpButton( shell, HelpUtils.getHelpDialogTitle( plugin ), plugin );
  shell.setImage( getImage( shell, plugin ) );
 } catch ( Throwable e ) {
  // Ignore unexpected errors, not worth it
 }
 return helpButton;
}

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

/**
 * Returns a {@link org.eclipse.swt.events.SelectionAdapter} that is used to "submit" the dialog.
 */
private Display prepareLayout() {
 // Prep the parent shell and the dialog shell
 final Shell parent = getParent();
 final Display display = parent.getDisplay();
 shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET );
 shell.setImage( GUIResource.getInstance().getImageSpoon() );
 props.setLook( shell );
 // Detect X or ALT-F4 or something that kills this window...
 shell.addShellListener( new ShellAdapter() {
  @Override
  public void shellClosed( ShellEvent e ) {
   dispose();
  }
 } );
 final FormLayout formLayout = new FormLayout();
 formLayout.marginWidth = MARGIN_SIZE;
 formLayout.marginHeight = MARGIN_SIZE;
 shell.setLayout( formLayout );
 shell.setText( this.title );
 return display;
}

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

public void open() {
 shell = new Shell( parentShell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
 props.setLook( shell );
 shell.setImage( GUIResource.getInstance().getImageSpoon() );

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

/**
 * Open the dialog.
 * @return the result
 */
public Object open() {
  shell = new Shell(getParent(), getStyle());
  shell.setImage(image);
  
  createContents();
  shell.open();
  shell.layout();
  Display display = getParent().getDisplay();
  while (!shell.isDisposed()) {
    try {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    } catch (Exception e) {
      MessageDialog.openError(shell, RedisClient.i18nFile.getText(I18nFile.ERROR), e.getLocalizedMessage());
    }
  }
  return result;
}

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

/**
 *
 * @param shell
 *          the shell.
 */
public SapInputAboutDialog( final Shell shell ) {
 this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
 GridLayout gridLayout = new GridLayout();
 gridLayout.numColumns = 2;
 this.dialog.setLayout( gridLayout );
 this.dialog.setText( BaseMessages.getString( PKG, "SapInputDialog.About.Shell.Title" ) );
 this.dialog.setImage( shell.getImage() );
 this.buildIconCell();
 this.buildPluginInfoCell();
 this.buildOkButton();
 this.dialog.pack();
 Rectangle shellBounds = shell.getBounds();
 Point dialogSize = this.dialog.getSize();
 this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
  + ( shellBounds.height - dialogSize.y ) / 2 );
}

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

/**
 *
 * @param shell
 *          the shell.
 */
public TeraFastAboutDialog( final Shell shell ) {
 this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
 GridLayout gridLayout = new GridLayout();
 gridLayout.numColumns = 2;
 this.dialog.setLayout( gridLayout );
 this.dialog.setText( BaseMessages.getString( PKG, "TeraFastDialog.About.Shell.Title" ) );
 this.dialog.setImage( shell.getImage() );
 this.buildIconCell();
 this.buildPluginInfoCell();
 this.buildOkButton();
 this.dialog.pack();
 Rectangle shellBounds = shell.getBounds();
 Point dialogSize = this.dialog.getSize();
 this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
  + ( shellBounds.height - dialogSize.y ) / 2 );
}

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

public List<Object[]> open() {
 shell = new Shell( parentShell, style );
 props.setLook( shell );
 shell.setImage( GUIResource.getInstance().getImageSpoon() );

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

/**
 *
 * @param shell
 *          the shell.
 */
public OlapInputAboutDialog( final Shell shell ) {
 this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
 GridLayout gridLayout = new GridLayout();
 gridLayout.numColumns = 2;
 this.dialog.setLayout( gridLayout );
 this.dialog.setText( BaseMessages.getString( PKG, "OlapInputDialog.About.Shell.Title" ) );
 this.dialog.setImage( shell.getImage() );
 this.buildIconCell();
 this.buildPluginInfoCell();
 this.buildOkButton();
 this.dialog.pack();
 Rectangle shellBounds = shell.getBounds();
 Point dialogSize = this.dialog.getSize();
 this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
  + ( shellBounds.height - dialogSize.y ) / 2 );
}

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

private void setShellImage( Shell shell ) {
  PluginInterface plugin = PluginRegistry.getInstance().getPlugin( PartitionerPluginType.class, partitioner.getId() );
  if ( !Utils.isEmpty( plugin.getDocumentationUrl() ) ) {
   createHelpButton( shell, stepMeta, plugin );
  }

  shell.setImage( GUIResource.getInstance().getImageSpoon() );
 }
}

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

public void createDialog( String title, String url, int options, Image logo ) {
 Shell parent = getParent();
 display = parent.getDisplay();
 dialog = new Shell( parent, options );
 dialog.setText( title );
 dialog.setImage( logo );
 dialog.setSize( width, height );
 dialog.setLayout( new FillLayout() );
 try {
  browser = new Browser( dialog, SWT.NONE );
  browser.setUrl( url );
  browser.addCloseWindowListener( new CloseWindowListener() {
   @Override
   public void close( WindowEvent event ) {
    Browser browser = (Browser) event.widget;
    Shell shell = browser.getShell();
    shell.close();
   }
  } );
 } catch ( Exception e ) {
  MessageBox messageBox = new MessageBox( dialog, SWT.ICON_ERROR | SWT.OK );
  messageBox.setMessage( "Browser cannot be initialized." );
  messageBox.setText( "Exit" );
  messageBox.open();
 }
 setPosition();
 dialog.open();
}

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

public void open() {
 shell = new Shell( display );
 shell.setLayout( new FillLayout() );
 shell.setText( APP_NAME );
 shell.setImage( GUIResource.getInstance().getImageLogoSmall() );
 try {
  readFiles();
 } catch ( Exception e ) {
  new ErrorDialog(
   shell, "Error reading translations", "There was an unexpected error reading the translations", e );
 }
 // Put something on the screen
 sashform = new SashForm( shell, SWT.HORIZONTAL );
 sashform.setLayout( new FormLayout() );
 addLists();
 addGrid();
 addListeners();
 sashform.setWeights( new int[] { 40, 60 } );
 sashform.setVisible( true );
 shell.pack();
 refresh();
 shell.setSize( 1024, 768 );
 shell.open();
}

相关文章

微信公众号

最新文章

更多

Shell类方法