Posts

Showing posts from 2018

Embed Swing control into SWT composite

For this requirement, we need an SWT_AWT bridge to create EmbeddedFrame which will be used to add Swing Controls. Sample Code: JLabel label = new JLabel("sample label"); Composite composite = new Composite(shell, SWT.EMBEDDED); Frame frame = SWT_AWT.new_Frame(composite); frame.setLayout(new BorderLayout()); frame.add(label,BorderLayout.CENTER);

Code to scale JFace/SWT image

Please find the code below ImageDescriptor scaleImage(Display display, ImageDescriptor imageDescriptor, int outMaxWidth, int outMaxHeight) { if (imageDescriptor == null) { return null; } ImageData imageData = imageDescriptor.getImageData(); if (imageData == null) { return imageDescriptor; } int newHeight = outMaxHeight; int newWidth = (imageData.width * newHeight) / imageData.height; if (newWidth > outMaxWidth) { newWidth = outMaxWidth; newHeight = (imageData.height * newWidth) / imageData.width; } // Use GC.drawImage Image outImage = new Image(display, newWidth, newHeight); GC gc = new GC(outImage); Image oldImage = imageDescriptor.createImage(); gc.drawImage(oldImage, 0, 0, imageData.width, imageData.height,

How to make Eclipse e4 RCP App Full-screen and Trimless

Image
To make your Eclipse e4 RCP App full-screen and trimless then you need to find your TrimmedWindow element in Windows & Dialog section of Application.e4xmi file. Add the tag shellMaximized and the persistentState value styleOverride to 8.