Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4762

How to force the timer to start

From simplicity <stella_pigeon@live.ca>
Newsgroups comp.lang.java.gui
Subject How to force the timer to start
Date 2011-11-23 18:25 -0800
Organization http://groups.google.com
Message-ID <3be9f413-0634-4b56-8e24-8d85dd121793@d5g2000prf.googlegroups.com> (permalink)

Show all headers | View raw


I see something strange and unexpected in the behaviour of the Timer
object. I would appreciate a hint about what is going on.

I am developing the prototype of the Swing application which is meant
to be a front end to the system which API is available in the native
language. The API uses C callback to communicate the changes in the
state of the system to the client application. In general, my
prototype works as follows:
(1) The Swing app allows the user to make calls to native methods via
JNA or xFunction (yes, I am writing two prototypes in parallel).
(2) The result from native callbacks are concentrated with a single
native interface that allows me to transfer data to Java.
(3) As the command is invoked, I start the timer and periodically call
that native interface to check if the state change occurred. When the
expected state is reached, the timer stops.

So, everything works fine, for example, I click "connect" button, the
click handler calls the C++ connect API, after a while onConnect
callback is executed which changes the state to connected, the next
call to actionPerformed() in my timer gets it.  Good...

However, I noticed the thing which I cannot explain. The above works
only if I move the cursor after clicking the "connect" button. If I
click and leave the cursor there I clicked, the timer does not seem to
execute. To be sure what is happening I put println() in
actionPerformed() and experimented by making sure that the cursor does
not move for several seconds. Until I move the mouse there is not a
single printed line in the output panel. Needless to say the if I
click "connect" and move the cursor (does not seem to matter how much)
printed lines start appearing in output until the expected state
change is detected - usually a second or two.

What am I missing? Is there a way to get the timer kick start
regardless of the mouse movement? Can someone help?

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

How to force the timer to start simplicity <stella_pigeon@live.ca> - 2011-11-23 18:25 -0800
  Re: How to force the timer to start Roedy Green <see_website@mindprod.com.invalid> - 2011-11-24 05:51 -0800
    Re: How to force the timer to start simplicity <stella_pigeon@live.ca> - 2011-11-24 11:02 -0800
      Re: How to force the timer to start Roedy Green <see_website@mindprod.com.invalid> - 2011-11-24 15:42 -0800
        Re: How to force the timer to start simplicity <stella_pigeon@live.ca> - 2011-11-25 15:14 -0800
          Re: How to force the timer to start Roedy Green <see_website@mindprod.com.invalid> - 2011-11-26 09:59 -0800
  Re: How to force the timer to start Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-26 15:45 -0800
    Re: How to force the timer to start simplicity <stella_pigeon@live.ca> - 2011-11-29 13:25 -0800
      Re: How to force the timer to start Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-29 15:46 -0800
      Re: How to force the timer to start Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-11-30 09:30 +0000

csiph-web