Canvas canvas =
new Canvas(container, SWT.NONE);
canvas.setBounds(10, 269, 167, 88);
ImageDescriptor descriptor= null;
try {
descriptor = ImageDescriptor.createFromURL( new URL("http://www.cnsucc.com/face/image/logo.jpg"));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final Image dogImage = descriptor.createImage();
canvas.addPaintListener( new PaintListener() {
public void paintControl( final PaintEvent event) {
if (dogImage != null) {
event.gc.drawImage(dogImage, 0, 0);
}
}
});
canvas.setBounds(10, 269, 167, 88);
ImageDescriptor descriptor= null;
try {
descriptor = ImageDescriptor.createFromURL( new URL("http://www.cnsucc.com/face/image/logo.jpg"));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final Image dogImage = descriptor.createImage();
canvas.addPaintListener( new PaintListener() {
public void paintControl( final PaintEvent event) {
if (dogImage != null) {
event.gc.drawImage(dogImage, 0, 0);
}
}
});
http://www.bianceng.cn/Programming/Java/201104/25808_7.htm
Canvas canvas =
new Canvas(container, SWT.NONE);
canvas.setBounds(10, 269, 167, 88);
final Image dogImage = new Image (Display.getCurrent(), "D:\\about.png");
canvas.addPaintListener( new PaintListener() {
public void paintControl( final PaintEvent event) {
if (dogImage != null) {
event.gc.drawImage(dogImage, 0, 0);
}
}
});
canvas.setBounds(10, 269, 167, 88);
final Image dogImage = new Image (Display.getCurrent(), "D:\\about.png");
canvas.addPaintListener( new PaintListener() {
public void paintControl( final PaintEvent event) {
if (dogImage != null) {
event.gc.drawImage(dogImage, 0, 0);
}
}
});