org.eclipse.swt.widgets.Shell#setImage ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Shell#setImage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tmxeditor8   文件: AbstractStyleEditorDialog.java
/**
 * Initialize and display the SWT shell. This is a blocking call.
 */
public void open() {
	Shell shell = new Shell(getParent(), getStyle());
	shell.setImage(GUIHelper.getImage("preferences"));
	shell.setText(getText());

	initComponents(shell);
	createButtons(shell);

	shell.pack();
	shell.open();
	Display display = shell.getDisplay();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
}
 
源代码2 项目: pentaho-kettle   文件: ModPartitionerDialog.java
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() );
}
 
源代码3 项目: hop   文件: BaseTransformDialog.java
private void setShellImage( Shell shell ) {
  if ( transformMeta != null ) {
    IPlugin plugin =
      PluginRegistry.getInstance().getPlugin( TransformPluginType.class, transformMeta.getTransform() );
    createHelpButton( shell, transformMeta, plugin );
    String id = plugin.getIds()[ 0 ];
    if ( id != null ) {
      shell.setImage( GuiResource.getInstance().getImagesTransforms().get( id ).getAsBitmapForSize(
        shell.getDisplay(), ConstUi.ICON_SIZE, ConstUi.ICON_SIZE ) );
    }
  }
}
 
源代码4 项目: pentaho-kettle   文件: Translator2.java
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();
}
 
源代码5 项目: hop   文件: Translator.java
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[] { 30, 70 } );
  sashform.setVisible( true );

  shell.pack();

  refresh();

  wPackages.optWidth( true );
  wPackages.getTable().getColumn( 1 ).setWidth( 1 );

  BaseTransformDialog.setSize( shell);

  shell.open();
}
 
源代码6 项目: tmxeditor8   文件: TBXMakerDialog.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.TBXMakerDialog.title"));
	imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TBXMAKER_PATH);
	newShell.setImage(Activator.getImageDescriptor(PluginConstants.LOGO_TBXMAKER_PATH).createImage());
}
 
源代码7 项目: tmxeditor8   文件: Martif2TBXConverterDialog.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.Martif2TBXConverterDialog.title"));
	imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_MARTIF2TBX_PATH);
	newShell.setImage(new Image(Display.getDefault(), imagePath));
}
 
源代码8 项目: tmxeditor8   文件: TMX2TXTConverterDialog.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.TMX2TXTConverterDialog.title"));
	imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TMX2TXTCONVERTER_PATH);
	newShell.setImage(new Image(Display.getDefault(), imagePath));
}
 
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.XSLTransformationDialog.title"));
	imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_XSL_PATH);
	newShell.setImage(new Image(Display.getDefault(), imagePath));
}
 
源代码10 项目: AndroidRobot   文件: NewScript.java
/**
 * Create contents of the dialog.
 */
private void createContents() {
	shell = new Shell(getParent(), getStyle());
	shell.setSize(450, 300);
	shell.setText(getText());
	shell.setImage(SWTResourceManager.getImage(".\\icons\\title.png"));
	shell.setLayout(new GridLayout(1,false));
	display = getParent().getDisplay();
	 
	Composite composite1 = new Composite(shell, SWT.NONE);
	GridData gd_composite1 = new GridData(435, 50);
	gd_composite1.verticalAlignment = SWT.CENTER;
	composite1.setLayoutData(gd_composite1);
	composite1.setLayout(new GridLayout(3,false));
	
	Label lbNewScript = new Label(composite1,SWT.CENTER);
	lbNewScript.setText("新建脚本框");
	lbNewScript.setFont(new Font(display,"宋体",12,SWT.BOLD));
	new Label(composite1, SWT.NONE);
	new Label(composite1, SWT.NONE);
	
	lblError = new Label(composite1, SWT.NONE);
	GridData gd_lblError = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
	gd_lblError.widthHint = 207;
	lblError.setLayoutData(gd_lblError);
	lblError.setText("New Label");
	lblError.setVisible(false);
       /*
	Label abc1 = new Label(composite1,SWT.CENTER);
	abc1.setText("                                                                         ");
	abc1.setVisible(false);
	Label abc2 = new Label(composite1,SWT.CENTER);
	FileInputStream input;
	try {
		input = new FileInputStream(new File(
				".\\icons\\title.png"));
		ImageData imageData = new ImageData(input);
		abc2.setImage(new Image(Display.getDefault(), imageData));
	} catch (FileNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
       */
	

}
 
源代码11 项目: tracecompass   文件: AddContextDialog.java
@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(Messages.TraceControl_AddContextDialogTitle);
    newShell.setImage(Activator.getDefault().loadIcon(ADD_CONTEXT_ICON_FILE));
}
 
源代码12 项目: tmxeditor8   文件: CSV2TMXConverterDialog.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.LanguageSettingDialog.title"));
	newShell.setImage(new Image(Display.getDefault(), imagePath));
}
 
源代码13 项目: Universal-FE-Randomizer   文件: MessageModal.java
public MessageModal(Shell parent, String title, String message) {
	display = Display.getDefault();
	yuneImage = new Image(display, Main.class.getClassLoader().getResourceAsStream("YuneIcon_100x100.png"));
	
	dialogShell = new Shell(parent, SWT.PRIMARY_MODAL | SWT.DIALOG_TRIM);
	dialogShell.setText(title);
	dialogShell.setImage(yuneImage);
	
	dialogShell.addListener(SWT.CLOSE, new Listener() {

		@Override
		public void handleEvent(Event event) {
			event.doit = false;
		}
		
	});
	
	FormLayout mainLayout = new FormLayout();
	mainLayout.marginWidth = 5;
	mainLayout.marginHeight = 5;
	dialogShell.setLayout(mainLayout);
	
	imageLabel = new Label(dialogShell, SWT.NONE);
	imageLabel.setImage(yuneImage);
	
	FormData imageData = new FormData(100, 100);
	imageData.left = new FormAttachment(0, 10);
	imageData.top = new FormAttachment(0, 10);
	imageLabel.setLayoutData(imageData);
	
	contentGroup = new Composite(dialogShell, SWT.NONE);
	FormLayout contentLayout = new FormLayout();
	contentLayout.marginTop = 5;
	contentLayout.marginLeft = 5;
	contentLayout.marginBottom = 5;
	contentLayout.marginRight = 5;
	contentGroup.setLayout(contentLayout);
	
	titleLabel = new Label(contentGroup, SWT.LEFT);
	titleLabel.setText(title);
	FontData normalFont = titleLabel.getFont().getFontData()[0];
	Font boldFont = new Font(display, normalFont.getName(), normalFont.getHeight(), SWT.BOLD);
	titleLabel.setFont(boldFont);
	
	FormData titleData = new FormData();
	titleData.top = new FormAttachment(0, 0);
	titleData.left = new FormAttachment(0, 0);
	titleData.right = new FormAttachment(100, 0);
	titleLabel.setLayoutData(titleData);
	
	descriptionLabel = new Label(contentGroup, SWT.LEFT | SWT.WRAP);
	descriptionLabel.setText(message);
	
	FormData descriptionData = new FormData();
	descriptionData.left = new FormAttachment(titleLabel, 0, SWT.LEFT);
	descriptionData.right = new FormAttachment(titleLabel, 0, SWT.RIGHT);
	descriptionData.top = new FormAttachment(titleLabel, 10);
	descriptionData.bottom = new FormAttachment(100, -5);
	Point expectedSize = descriptionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	descriptionData.width = Math.max(200, expectedSize.x);
	descriptionData.height = Math.max(60, expectedSize.y);
	descriptionLabel.setLayoutData(descriptionData);
	
	FormData groupData = new FormData();
	groupData.left = new FormAttachment(imageLabel, 10);
	groupData.top = new FormAttachment(imageLabel, 0, SWT.TOP);
	groupData.right = new FormAttachment(100, -10);
	contentGroup.setLayoutData(groupData);
	
	layoutSize();
	Rectangle parentBounds = parent.getBounds();
	Rectangle dialogBounds = dialogShell.getBounds();
	
	dialogShell.setLocation(parentBounds.x + (parentBounds.width - dialogBounds.width) / 2, parentBounds.y + (parentBounds.height - dialogBounds.height) / 2);
}
 
源代码14 项目: tracecompass   文件: SaveDialog.java
@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(Messages.TraceControl_SaveDialogTitle);
    newShell.setImage(Activator.getDefault().loadIcon(EXPORT_ICON_FILE));
}
 
源代码15 项目: nebula   文件: Snippet3.java
/**
 * Create contents of the window.
 */
protected void createContents() {

	shell = new Shell();
	shell.setImage(null);
	shell.setSize(600, 190);
	shell.setText("SWT Application");
	shell.setLayout(new GridLayout(1, false));

	final Oscilloscope scope = new Oscilloscope(shell, SWT.NONE);
	scope.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	new OscilloscopeDispatcher() {

		@Override
		public int getDelayLoop() {
			return 40;
		}

		@Override
		public boolean getFade() {
			return false;
		}

		public int getPulse() {
			return 60;
		};

		public int getTailSize() {
			return Oscilloscope.TAILSIZE_DEFAULT;
		};

		@Override
		public void hookSetValues(int value) {
			scope.setValues(0,Oscilloscope.HEARTBEAT);
		}

		public File getActiveSoundfile() {
			return new File(HEARTBEAT); // add to classpath
		};

		@Override
		public boolean isSoundRequired() {
			return true;
		}

		@Override
		public Oscilloscope getOscilloscope() {
			return scope;
		}
	}.dispatch();

}
 
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.title"));
	newShell.setImage(new Image(Display.getDefault(), imagePath));
}
 
源代码17 项目: RepDev   文件: FailedLogonShell.java
private void create() {
	failShell = new Shell(SWT.APPLICATION_MODAL | SWT.TITLE | SWT.CLOSE);
	failShell.setText("Invalid Password");
	failShell.setImage(RepDevMain.smallSymAddImage);
	
	FormLayout layout = new FormLayout();
	layout.marginTop = 5;
	layout.marginBottom = 5;
	layout.marginLeft = 5;
	layout.marginRight = 5;
	layout.spacing = 5;
	failShell.setLayout(layout);
	
	FailText = new Label(failShell, SWT.NONE);
	FailText.setText("Please retype your userID:");
	
	pass = new Text(failShell, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);	
	
	Button ok = new Button(failShell, SWT.PUSH);
	ok.setText("Submit");
	ok.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {	
			newPass = pass.getText();
			failShell.close();
		}
	});
	
	FormData data = new FormData();
	
	data = new FormData();
	data.left = new FormAttachment(0);
	//data.right = new FormAttachment(100);
	data.top = new FormAttachment(0);
	//data.bottom = new FormAttachment();
	FailText.setLayoutData(data);
	
	data = new FormData();
	data.left = new FormAttachment(0);
	data.right = new FormAttachment(100);
	data.top = new FormAttachment(FailText);
	//data.bottom = new FormAttachment(ok);
	pass.setLayoutData(data);
	
	data = new FormData();
	data.left = new FormAttachment(0);
	//data.right = new FormAttachment(100);
	data.top = new FormAttachment(pass);
	data.bottom = new FormAttachment(100);
	ok.setLayoutData(data);
	
	failShell.setDefaultButton(ok);
	
	failShell.pack();
	failShell.open();
	
	while (!failShell.isDisposed()) {
		if (!failShell.getDisplay().readAndDispatch())
			failShell.getDisplay().sleep();
	}
}
 
源代码18 项目: translationstudio8   文件: ColumnRemoveDialog.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText(Messages.getString("dialog.ColumnRemoveDialog.title"));
	newShell.setImage(new Image(Display.getDefault(), imgPath));
}
 
源代码19 项目: tracecompass   文件: LoadDialog.java
@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(Messages.TraceControl_LoadDialogTitle);
    newShell.setImage(Activator.getDefault().loadIcon(IMPORT_ICON_FILE));
}
 
源代码20 项目: tracecompass   文件: CreateSessionDialog.java
@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(Messages.TraceControl_CreateSessionDialogTitle);
    newShell.setImage(Activator.getDefault().loadIcon(CREATE_SESSION_ICON_FILE));
}