-
Notifications
You must be signed in to change notification settings - Fork 4
Picture
greipadmin edited this page Dec 5, 2018
·
15 revisions

This widget simply shows a Picture. Supported picture formats: PNG, BMP, JPEG, GIF (including animated GIFs), ICO and TIFF.
-
Picture(Composite parent, int style)-
parenta widget which will be the parent of the new Picture widget. -
stylethe style of widget to construct.
-
-
loadImage(String)loads an image from the file with the specified name. -
loadImage(InputStream)loads an image from the specified input stream. -
setImage(Image)sets the image. -
scaleTo(Point)scale the image to specified size. Default isPoint(SWT.DEFAULT, SWT.DEFAULT), that means the original image size.Point(100, SWT.DEFAULT)means scale to width 100px and calculate the new height.
The size of the widget is the scaled size of the image. Is no image loaded, the size is Point(0, 0).
final Picture picture = new Picture(shell, SWT.BORDER);
final FileDialog dialog = new FileDialog(shell);
dialog.setFilterExtensions(new String[] { "*.bmp;*.gif;*.jpg;*.png" });
final String filename = dialog.open();
if (filename != null) {
picture.loadImage(filename);
}