Java Code Examples for org.eclipse.swt.SWT#SHELL_TRIM
The following examples show how to use
org.eclipse.swt.SWT#SHELL_TRIM .
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: AbstractContainmentExample.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * */ public AbstractContainmentExample(String title) { Display display = new Display(); shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); shell.setText(title); shell.setBounds(0, 0, 640, 480); shell.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); // open the shell before creating the controllable shapes so that their // default coordinates are not changed due to the resize of their canvas shell.open(); controllableShape1 = createControllableShape1(shell); controllableShape2 = createControllableShape2(shell); shell.addPaintListener(this); shell.redraw(); // triggers a PaintEvent platform independently while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
Example 2
Source File: DiskWindow.java From AppleCommander with GNU General Public License v2.0 | 6 votes |
/** * Setup the Disk window and display (open) it. */ public void open() { shell = new Shell(parentShell, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); shell.setImage(imageManager.get(ImageManager.ICON_DISK)); setStandardWindowTitle(); shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { dispose(event); } }); CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM); new DiskExplorerTab(tabFolder, disks, imageManager, this); diskMapTabs = new DiskMapTab[disks.length]; for (int i=0; i<disks.length; i++) { if (disks[i].supportsDiskMap()) { diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]); } } diskInfoTab = new DiskInfoTab(tabFolder, disks); tabFolder.setSelection(tabFolder.getItems()[0]); shell.open(); }
Example 3
Source File: GridPrintCellClippingExample.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Executes the GridPrintNoBreak example. * * @param args * the command line arguments. */ public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new GridLayout()); shell.setSize(600, 600); PrintJob job = new PrintJob("GridPrintNoBreakExample", createPrint()); final PrintPreview preview = new PrintPreview(shell, SWT.BORDER); preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); preview.setPrintJob(job); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); PaperClips.print(job, new PrinterData()); }
Example 4
Source File: SwtPlugin.java From jframe with Apache License 2.0 | 6 votes |
public void run() { try { Display display = Display.getCurrent(); if (display == null) display = Display.getDefault(); display.addFilter(SWT.Close, new Listener() { public void handleEvent(Event event) { event.doit = false; } }); app = new JframeApp(display, SWT.SHELL_TRIM); Shell shell = app.getShell(); shell.open(); // shell.pack(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (!app.isDisposed()) app.dispose(); display.dispose(); } catch (Exception e) { LOG.error(e.getMessage(), e.fillInStackTrace()); } }
Example 5
Source File: GridPrintExample.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Executes the GridPrint example. * * @param args * the command line arguments. */ public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); shell.setSize(600, 600); final PrintViewer preview = new PrintViewer(shell, SWT.BORDER); preview.setPrint(createPrint()); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); PaperClips.print(new PrintJob("GridPrintExample", createPrint()), new PrinterData()); }
Example 6
Source File: AbstractIntersectionExample.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * */ public AbstractIntersectionExample(String title, String... infos) { Display display = new Display(); shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); shell.setText(title); shell.setBounds(0, 0, 640, 480); shell.setLayout(new FormLayout()); shell.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); Label infoLabel = new Label(shell, SWT.NONE); FormData infoLabelFormData = new FormData(); infoLabelFormData.right = new FormAttachment(100, -10); infoLabelFormData.bottom = new FormAttachment(100, -10); infoLabel.setLayoutData(infoLabelFormData); String infoText = "You can..."; for (int i = 0; i < infos.length; i++) { infoText += "\n..." + infos[i]; } infoLabel.setText(infoText); // open the shell before creating the controllable shapes so that their // default coordinates are not changed due to the resize of their canvas shell.open(); controllableShape1 = createControllableShape1(shell); controllableShape2 = createControllableShape2(shell); shell.addPaintListener(this); shell.redraw(); // triggers a PaintEvent platform independently while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
Example 7
Source File: MainView.java From Universal-FE-Randomizer with MIT License | 5 votes |
public MainView(Display mainDisplay) { super(); Shell shell = new Shell(mainDisplay, SWT.SHELL_TRIM & ~SWT.MAX); shell.setText("Yune: A Universal Fire Emblem Randomizer (v0.9.1)"); shell.setImage(new Image(mainDisplay, Main.class.getClassLoader().getResourceAsStream("YuneIcon.png"))); screenHeight = mainDisplay.getBounds().height; for (Monitor monitor : mainDisplay.getMonitors()) { screenHeight = Math.max(screenHeight, monitor.getClientArea().height); } screenHeight -= 20; mainShell = shell; setupMainShell(); resize(); /* Open shell window */ mainShell.open(); mainDisplay.addFilter(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event event) { if (((event.stateMask & SWT.CTRL) != 0) && ((event.stateMask & SWT.SHIFT) != 0) && (event.keyCode == 'c') && !consoleShellOpened) { openConsole(); } } }); }
Example 8
Source File: UncertaintyShell.java From olca-app with Mozilla Public License 2.0 | 5 votes |
public static void show(NumberGenerator fun) { Display display = Display.getCurrent(); Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM); shell.setText(M.TestDistribution); shell.setLayout(new FillLayout()); StatisticsCanvas canvas = new StatisticsCanvas(shell); shell.pack(); shell.setSize(620, 400); shell.open(); new Thread() { public void run() { List<Double> values = new ArrayList<>(); for (int i = 0; i < 1000; i++) { values.add(fun.next()); if (!shell.isDisposed()) display.syncExec(() -> { if (shell.isDisposed()) return; double[] vals = values.stream() .mapToDouble(Double::doubleValue) .toArray(); canvas.setValues(vals); }); } if (!display.isDisposed()) { display.wake(); } } }.start(); }
Example 9
Source File: SelectVisibleColumnDialog.java From logbook with MIT License | 5 votes |
/** * Create contents of the dialog. */ private void createContents() { this.shell = new Shell(this.getParent(), SWT.SHELL_TRIM | SWT.PRIMARY_MODAL); this.shell.setSize(300, 275); this.shell.setText("列の表示非表示"); this.shell.setLayout(new FillLayout(SWT.HORIZONTAL)); // ヘッダー String[] header = Stream.of(this.table.getColumns()).map(c -> c.getText()).toArray(String[]::new); // カラム設定を取得 boolean[] visibles = AppConfig.get().getVisibleColumnMap().get(this.clazz.getName()); if ((visibles == null) || (visibles.length != header.length)) { visibles = new boolean[header.length]; Arrays.fill(visibles, true); AppConfig.get().getVisibleColumnMap().put(this.clazz.getName(), visibles); } Tree tree = new Tree(this.shell, SWT.BORDER | SWT.CHECK); for (int i = 1; i < header.length; i++) { TreeItem column = new TreeItem(tree, SWT.CHECK); column.setText(header[i]); column.setChecked(visibles[i]); column.setExpanded(true); } this.shell.addShellListener(new TreeShellAdapter(tree, visibles)); }
Example 10
Source File: ImageCanvas.java From AppleCommander with GNU General Public License v2.0 | 5 votes |
/** * Constructor for ImageCanvas. */ public ImageCanvas(Composite parent, int style, Image image, Object layoutData) { super(parent, style | SWT.SHELL_TRIM | SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE); this.image = image; setLayoutData(layoutData); setSize(image.getImageData().width, image.getImageData().height); addPaintListener(this); }
Example 11
Source File: AlignPrintExample.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Prints the BreakPrintExample to the default printer. * * @param args * command-line args */ public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); PrintDialog dialog = new PrintDialog(shell, SWT.NONE); PrinterData printerData = dialog.open(); shell.dispose(); display.dispose(); if (printerData != null) PaperClips.print(new PrintJob("AlignPrintExample.java", createPrint()), printerData); }
Example 12
Source File: GeoMapViewerTest.java From nebula with Eclipse Public License 2.0 | 5 votes |
protected Widget createUI(Display display) { Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("GeoMap Widget - SWT Native Map Browsing, Map data from openstreetmap.org"); shell.setSize(600, 710); shell.setLocation(10, 10); shell.setLayout(new FillLayout()); createControls(shell); shell.open(); return shell; }
Example 13
Source File: AbstractExample.java From gef with Eclipse Public License 2.0 | 4 votes |
public AbstractExample(String title, String... infos) { Display display = new Display(); shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); shell.setText(title); shell.setBounds(0, 0, 640, 480); shell.setLayout(new FormLayout()); if (infos.length > 0) { Label infoLabel = new Label(shell, SWT.NONE); FormData infoLabelFormData = new FormData(); infoLabelFormData.right = new FormAttachment(100, -10); infoLabelFormData.bottom = new FormAttachment(100, -10); infoLabel.setLayoutData(infoLabelFormData); String infoText = "You can..."; for (int i = 0; i < infos.length; i++) { infoText += "\n..." + infos[i]; } infoLabel.setText(infoText); } // open the shell before creating the controllable shapes so that their // default coordinates are not changed due to the resize of their canvas shell.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); shell.open(); viewer = new ControllableShapeViewer(shell); for (ControllableShape cs : getControllableShapes()) { viewer.addShape(cs); } onInit(); shell.addPaintListener(this); shell.redraw(); // triggers a PaintEvent platform independently while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
Example 14
Source File: ComboBoxColorCellEditor.java From birt with Eclipse Public License 1.0 | 4 votes |
protected Object openDialogBox( Control cellEditorWindow ) { Shell shell = new Shell( Display.getCurrent( ), SWT.SHELL_TRIM ); shell.setLocation( cellEditorWindow.toDisplay( 0, 0 ).x + cellEditorWindow.getBounds( ).width, cellEditorWindow.toDisplay( 0, 0 ).y - cellEditorWindow.getBounds( ).height ); ColorDialog dialog = new ColorDialog( shell, SWT.APPLICATION_MODAL ); RGB[] rgbs = ReportPlugin.getDefault( ).getCustomColorsPreference( ); if ( rgbs != null ) { dialog.setRGBs( rgbs ); } Object value = getValue( ); try { int color; if ( value instanceof String ) { color = ColorUtil.parseColor( (String) value ); } else { color = ( (Integer) value ).intValue( ); } dialog.setRGB( DEUtil.getRGBValue( color ) ); } catch ( Exception e ) { // ignore. } value = dialog.open( ); ReportPlugin.getDefault( ) .setCustomColorsPreference( dialog.getRGBs( ) ); if ( value != null && dialog.getRGB( ) != null ) { deactivate( ); return ColorUtil.format( ColorUtil.formRGB( dialog.getRGB( ).red, dialog.getRGB( ).green, dialog.getRGB( ).blue ), ColorUtil.HTML_FORMAT ); } comboBox.setFocus( ); shell.dispose( ); return value; }
Example 15
Source File: JframeApp.java From jframe with Apache License 2.0 | 4 votes |
public JframeApp(Display display) { this(display, SWT.SHELL_TRIM); }
Example 16
Source File: GridPrintVerticalAlignmentExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Executes the GridPrint example. * * @param args * the command line arguments. */ public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("GridPrintVerticalAlignmentExample.java"); shell.setLayout(new GridLayout()); shell.setSize(600, 800); final PrintJob job = new PrintJob( "GridPrintVerticalAlignmentExample.java", createPrint()); Composite buttonPanel = new Composite(shell, SWT.NONE); buttonPanel .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); buttonPanel.setLayout(new RowLayout(SWT.HORIZONTAL)); final PrintPreview preview = new PrintPreview(shell, SWT.BORDER); Button prev = new Button(buttonPanel, SWT.PUSH); prev.setText("<< Prev"); prev.addListener(SWT.Selection, event -> { preview.setPageIndex(Math.max(preview.getPageIndex() - 1, 0)); }); Button next = new Button(buttonPanel, SWT.PUSH); next.setText("Next >>"); next.addListener(SWT.Selection, event -> { preview.setPageIndex(Math.min(preview.getPageIndex() + 1, preview.getPageCount() - 1)); }); Button print = new Button(buttonPanel, SWT.PUSH); print.setText("Print"); print.addListener(SWT.Selection, event -> { PaperClips.print(job, new PrinterData()); }); preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); preview.setFitHorizontal(true); preview.setFitVertical(true); preview.setPrintJob(job); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose(); }
Example 17
Source File: StyledTextPrintExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Executes the StyledTextPrint example. * * @param args * the command line arguments. */ public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("StyledTextPrintExample.java"); shell.setLayout(new GridLayout()); shell.setSize(600, 800); final PrintJob job = new PrintJob("StyledTextPrintExample.java", createPrint()); Composite buttonPanel = new Composite(shell, SWT.NONE); buttonPanel .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); buttonPanel.setLayout(new RowLayout(SWT.HORIZONTAL)); final PrintPreview preview = new PrintPreview(shell, SWT.BORDER); Button prev = new Button(buttonPanel, SWT.PUSH); prev.setText("<< Prev"); prev.addListener(SWT.Selection, event -> { preview.setPageIndex(Math.max(preview.getPageIndex() - 1, 0)); }); Button next = new Button(buttonPanel, SWT.PUSH); next.setText("Next >>"); next.addListener(SWT.Selection, event -> { preview.setPageIndex(Math.min(preview.getPageIndex() + 1, preview.getPageCount() - 1)); }); Button print = new Button(buttonPanel, SWT.PUSH); print.setText("Print"); print.addListener(SWT.Selection, event -> { PrintDialog dialog = new PrintDialog(shell); PrinterData printerData = dialog.open(); if (printerData != null) PaperClips.print(job, printerData); }); preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); preview.setFitHorizontal(true); preview.setFitVertical(true); preview.setPrintJob(job); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose(); }
Example 18
Source File: PagePrintExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Executes the GridPrint example. * * @param args * the command line arguments. */ public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("PagePrintExample.java"); shell.setLayout(new GridLayout()); shell.setSize(600, 800); final PrintJob job = new PrintJob("PagePrintExample.java", createPrint()); Composite buttonPanel = new Composite(shell, SWT.NONE); buttonPanel .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); buttonPanel.setLayout(new RowLayout(SWT.HORIZONTAL)); final PrintPreview preview = new PrintPreview(shell, SWT.BORDER); Button prev = new Button(buttonPanel, SWT.PUSH); prev.setText("<< Prev"); prev.addListener(SWT.Selection, event -> { preview.setPageIndex(Math.max(preview.getPageIndex() - 1, 0)); }); Button next = new Button(buttonPanel, SWT.PUSH); next.setText("Next >>"); next.addListener(SWT.Selection, event -> { preview.setPageIndex(Math.min(preview.getPageIndex() + 1, preview.getPageCount() - 1)); }); Button print = new Button(buttonPanel, SWT.PUSH); print.setText("Print"); print.addListener(SWT.Selection, event -> { PaperClips.print(job, new PrinterData()); }); preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); preview.setFitHorizontal(true); preview.setFitVertical(true); preview.setPrintJob(job); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose(); }
Example 19
Source File: RuntimeInfoDialog.java From tesb-studio-se with Apache License 2.0 | 2 votes |
/** * DOC yyan RuntimeInfoDialog constructor comment. * * @param activeShell * @param list * @param applicationModal */ public RuntimeInfoDialog(List<Map<String, String>> list) { super(Display.getCurrent().getActiveShell(), SWT.SHELL_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL); this.attrInfo = list; }
Example 20
Source File: AbstractPictureControl.java From nebula with Eclipse Public License 2.0 | 2 votes |
/** * Returns the {@link FileDialog}SWT style. This method can be override if * the SWT style should be customized. * * @return */ protected int getFileDialogStyle() { return SWT.SHELL_TRIM | SWT.SINGLE | SWT.APPLICATION_MODAL; }