Java Code Examples for org.eclipse.swt.widgets.Shell#setImage()
The following examples show how to use
org.eclipse.swt.widgets.Shell#setImage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractStyleEditorDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 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(); } }
Example 2
Source File: TBXMakerDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 3
Source File: XSLTransformationDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@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)); }
Example 4
Source File: TMX2TXTConverterDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@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)); }
Example 5
Source File: Martif2TBXConverterDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@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)); }
Example 6
Source File: Translator.java From hop with Apache License 2.0 | 5 votes |
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(); }
Example 7
Source File: Translator2.java From pentaho-kettle with Apache License 2.0 | 5 votes |
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(); }
Example 8
Source File: BaseTransformDialog.java From hop with Apache License 2.0 | 5 votes |
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 ) ); } } }
Example 9
Source File: ModPartitionerDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
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() ); }
Example 10
Source File: CSV2TMXConverterDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.LanguageSettingDialog.title")); newShell.setImage(new Image(Display.getDefault(), imagePath)); }
Example 11
Source File: MessageModal.java From Universal-FE-Randomizer with MIT License | 4 votes |
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); }
Example 12
Source File: SaveDialog.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.TraceControl_SaveDialogTitle); newShell.setImage(Activator.getDefault().loadIcon(EXPORT_ICON_FILE)); }
Example 13
Source File: NewScript.java From AndroidRobot with Apache License 2.0 | 4 votes |
/** * 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(); } */ }
Example 14
Source File: Snippet3.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * 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(); }
Example 15
Source File: AddContextDialog.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.TraceControl_AddContextDialogTitle); newShell.setImage(Activator.getDefault().loadIcon(ADD_CONTEXT_ICON_FILE)); }
Example 16
Source File: CSV2TMXConverterDialog.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.title")); newShell.setImage(new Image(Display.getDefault(), imagePath)); }
Example 17
Source File: FailedLogonShell.java From RepDev with GNU General Public License v3.0 | 4 votes |
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(); } }
Example 18
Source File: ColumnRemoveDialog.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.getString("dialog.ColumnRemoveDialog.title")); newShell.setImage(new Image(Display.getDefault(), imgPath)); }
Example 19
Source File: LoadDialog.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.TraceControl_LoadDialogTitle); newShell.setImage(Activator.getDefault().loadIcon(IMPORT_ICON_FILE)); }
Example 20
Source File: CreateSessionDialog.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.TraceControl_CreateSessionDialogTitle); newShell.setImage(Activator.getDefault().loadIcon(CREATE_SESSION_ICON_FILE)); }