Desktop program development using Eclipse RCP (v): 2D drawing

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.