Yes!
Perfectly sure. I've printed some debug statements at the native part
and in the Java paint(...) part.
So there's nothing special about the code snippets that's wrong?
/Christer
On Wed, Jun 24, 2009 at 2:43 PM, Timothy Wall<twal...@dev.java.net> wrote:
Are you certain your "paint" method is being called?
If so, try the most simple drawing operation first (like a fill or a line).
On Jun 24, 2009, at 8:07 AM, Christer Sandberg wrote:
Hi!
I've been trying to do a simple thing. Say that I have a
java.awt.Canvas instance that I want some native code to draw on.
The native code (i.e. method) in a DLL could look something like this:
void simpleDraw(HWND hwnd)
{
PAINTSTRUCT ps;
HDC hdc;
RECT rc;
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc);
FrameRect(hdc, &rc, GetStockBrush(BLACK_BRUSH));
DrawText(hdc, L"This is a simple draw...", 24, &rc, DT_SINGLELINE |
DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &ps);
}
The way I call it is to extends a Canvas paint method and invoke this as:
public void paint(Graphics g) {
lib.simpleDraw(Native.getComponentPointer(this));
}
The problem that I'm having is that nothing get's drawn on the canvas.
How should I do this simple thing. I must be missing something!?
Thanks in advance,
Christer