Skip to main content



      Home
Home » Newcomers » Newcomers » ViewPart painting
ViewPart painting [message #124531] Sat, 17 December 2005 02:30 Go to next message
Eclipse UserFriend
Originally posted by: datatronics.verizon.net

I have not been able to figure out how to
obtain a Graphics Context from within a ViewPart

the JDT RCP environment doesn't seem to allow me to
addPaintListener() to either a Canvas created within a ViewPart
nor to "parent" Composite provided by createPartControl()

is it possible for me to draw within a ViewPart?
Re: ViewPart painting [message #125210 is a reply to message #124531] Tue, 20 December 2005 20:37 Go to previous message
Eclipse UserFriend
Originally posted by: steve.candlelightsoftware.com

private Canvas canvas;

public void createPartControl(Composite parent) {

canvas = new Canvas( parent, SWT.NULL);
canvas.addPaintListener(new PaintListener() {
public void paintControl(final PaintEvent event) {

GC gc = event.gc;
gc.setLineWidth (4);
gc.drawRectangle (20, 20, 100, 100);
}
});
}

public void setFocus() {
canvas.setFocus();
}
Previous Topic:color
Next Topic:eclipse plugins on lin redhat 32
Goto Forum:
  


Current Time: Mon Jun 30 13:14:15 EDT 2025

Powered by FUDForum. Page generated in 0.50566 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top