[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] listeners pattern

An even better question: Why isn't there a prominent Unsubscribe option on:

https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

?

Bob Foster

cyberdeth@xxxxxxxxxx wrote:
How do i unsubscribe from this list ?

On Thu Mar 17  4:37 , Thomas Braun <mail@xxxxxxxxxxxxxxx> sent:


If you do it the second way your class has a public method paintControl(PaintEvent) which can be called by anyone, but from outside the class painting should be started by calling redraw().
On the other hand it is not wrong that XXX implements PaintListener. I think it's only bad style because you have a public method which should not be called.


Tom

alef-zero@xxxxx wrote:

Hi, can someone explain me why in all examlpes of custom widgets in
SWT I found, there is always sth like :
class XXX extends Canvas {
//
		addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent e) {
				XXX.this.paintControl(e);
			}
		});
//
}
Why not :
class XXX extends Canvas implements PaintListener {
//
   addPaintListener(this);
//
}

Should I avoid using implementing listener interfaces or is it only
populated someone style of writing?

Thanks,
Albert



_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev



_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev