Skip to content

Picture

greipadmin edited this page Feb 5, 2017 · 15 revisions

Introduction

This widget simply shows a Picture. Supported picture formats: PNG, BMP, JPEG, GIF (including animated GIFs), ICO and TIFF.

Constructors

  • Picture(Composite parent) or Picture(Composite parent, Point imageSize)
  • parent the parent Composite
  • imageSize the scaled size of the image. Use SWT.DEFAULT for the original image height/width.

Methods

  • loadImage(String) or loadImage(InputStream) loads images from file.
  • setImage(Image) sets the image.

The size of the widget is the scaled size of the image. Is no image loaded, the size is Point(0, 0).

Example

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);
}
Clone this wiki locally