After reading this article, you can implement the following interface:
When I first saw RCP, I dreamed that one day I would be able to use it to develop a gorgeous 2D and 3D program, through the previous exploration, today can finally uncover the mystery of 2D drawing. In the bundle Resource manager's plug-in dependencies, we can see the Org.eclipse.swt.graphics package at a glance, and there is no doubt that the class related to the 2D drawing is in this package. There is also a org.eclipse.swt.opengl bag is eye-catching, but there are only GLCanvas class and Gldata class, how can not find the legendary GL class and Glu class, perhaps the next article I will write about 3D content, but perhaps this plan will die.
When I first discovered the Org.eclipse.swt.graphics package, it was not so easy to use the classes in the package. For example, you can see from the name that the image class is working with images, but its constructors require a Device parameter without exception, so I'm puzzled, Device, how do I get it? For example, the GC class contains various methods of drawing, but the GC constructor requires drawable parameters, so how do I get drawable?
So, I was searching the web for the SWT 2D, and finally, let me see someone like this constructs image and GC:
Image img = new Image (Display, "pic.gif");
GC GC = new GC (Image);
What can you tell? Why is display a subclass of device? Why is image a subclass of Drawabe? The simplest approach is to use Eclipse's class hierarchy view to view: