Re: Odd stuff with Cocoa-Java
Re: Odd stuff with Cocoa-Java
- Subject: Re: Odd stuff with Cocoa-Java
- From: Ed Baskerville <email@hidden>
- Date: Mon, 1 Oct 2001 14:04:38 -0400
(This is it so pay attention): the timer does not start. Let me repeat
that. The timer doesn't start.
This is because you didn't register it with the run loop. In
Objective-C, there's a class method that creates *and* registers the
timer, but in Java there's no such method.
To create it and register it, use this code:
// begin code fragment
NSTimer myTimer = new NSTimer( minutes * 60, this,
fireMethod, null, false );
NSRunLoop runLoop = NSRunLoop.currentRunLoop();
runLoop.addTimerForMode( myTimer, runLoop.currentMode() );
// end code fragment
--Ed Baskerville