PaintListener not listening [message #1726406] |
Sat, 12 March 2016 20:22 |
Mark Mising name Messages: 73 Registered: July 2009 Location: Ohio, USA |
Member |
|
|
I'm creating a new widget by extending Canvas. My code has been uploaded. In the main code, after instantiating the widget, I call setHydrograph(), which calls redraw(), which fires a Paint event (supposedly). But my Paint Event handler never prints the flagging text. All (or most) of the other event handlers (like, for Mouse action or the dispose event) get called, and the flagging text gets written.
I've reworked this code several times, and studied other examples online, and cannot detect anything I am doing wrong. Do you have any ideas why my Paint handler doesn't seem to get called?
Mark
|
|
|
Re: PaintListener not listening [message #1726413 is a reply to message #1726406] |
Sun, 13 March 2016 04:25 |
Eclipse User |
|
|
|
Your code doesn't actually have any 'flagging text' for your paint events:
this.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
HGviewer.this.paintControl(e);
}
});
Since you're seeing mouse messages, it seems safe to assume that your widget has an expected size. Instead of drawing an image, set the background to a standard system colour and do a fillRectangle of your widget area. At least then you should be able to tell if your paint event is happening or whether there's a deeper issue with your image being drawn.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03701 seconds