• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Odd stuff with Cocoa-Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: RE: NSScrollView and general IB annoyance
  • Next by Date: RE: NSScrollView and general IB annoyance
  • Previous by thread: Re: Odd stuff with Cocoa-Java
  • Next by thread: Re: Odd stuff with Cocoa-Java
  • Index(es):
    • Date
    • Thread