Skip to content

Picture

greipadmin edited this page Feb 4, 2017 · 15 revisions

Introduction

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

Methods

  • loadImage(String) or loadImage(InputStream) loads images from file.
  • setImage(Image) sets the image.
  • setMinDelay(int) defines the delay between two images in animated GIFs. Default is 50 ms.
  • getMinDelay() gets the current delay.

The size of the widget is the 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