Results 1 to 4 of 4
Thread: programmaticly trigger an event
- 02-22-2009, 11:07 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 15
- Rep Power
- 0
-
In my mind it depends. What else then would trigger the code? another event? a time interval?
- 02-23-2009, 01:26 AM #3
Senior Member
- Join Date
- Jul 2008
- Posts
- 125
- Rep Power
- 0
Two entities fight for one task
I'm going to assume that the computer, and the
mouse operator act independent of each other,
That they don't care what the other is doing,
but at least they must 'respect' each other.
So, write an application or applet where only the
mouse operator performs the operation you want.
Then write an application or applet where the
computer alone performs this operation.
Now you know this much of the code can work.
To create the final code, throw both of them
together. (I state it this way because I have no
idea what your goal is, and this statement is
concise enough.)
THIS IS THE IMPORTANT PART:
To avoid contention between the mouse operator
and the computer, set up two flags:
Modify your mouseEvent with a test ofJava Code:boolean mouseHasFunction = false; boolean computerHasFunction = false;
the "computerHasFunction" flag:
And for the computer, modify its process with aJava Code:if(!computerHasFunction){ mouseHasFunction = true; whatever you or the computer want to do.. mouseHasFunction = false; }
test of the "mouseHasFunction" flag:
Java Code:if(!mouseHasFunction){ computerHasFunction = true; whatever you or the computer want to do.. computerHasFunction = false; }
- 02-23-2009, 03:27 PM #4
Member
- Join Date
- Apr 2008
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Key event
By ivvgangadhar in forum Threads and SynchronizationReplies: 1Last Post: 12-11-2008, 09:27 AM -
JSlider (to NOT cont'd trigger statechanged )
By hanifa in forum AWT / SwingReplies: 4Last Post: 09-19-2008, 07:58 AM -
sending the message from trigger to mailid
By geeta_ravikanti in forum JDBCReplies: 0Last Post: 04-04-2008, 11:09 AM -
Event
By nt5515 in forum New To JavaReplies: 0Last Post: 02-15-2008, 04:44 PM -
Timer which should never end and should trigger daily
By garinapavan in forum New To JavaReplies: 0Last Post: 08-10-2007, 05:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks