Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
JAPI Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 16 Jahren
Letzter Beitrag:
vor 16 Jahren
Beteiligte Autoren:
Terry Brown, Merten

missing button events??

Startbeitrag von Terry Brown am 03.08.2002 16:27

I built a simple application that contains a button that, when pressed with the left mouse button increments a variable that is displayed as the button's text:

if(obj==fga_button) {
fga++;
sprintf(tbuf,"%d",fga);
j_settext(fga_button,tbuf);
}

And it works, but if button presses occur too rapidly (just press the mouse button even reasonably fast, no event occurs.

Are events not queued? And if not, what takes so long. I probably have to wait nearly a second for it to work again.

thanks,

Antworten:

Hi Terry,

I've just tested your example (see below), and ..... it works fine. I've pressed the mousebutton as fast as i could again and again. Nearly all events are detected.

If an event is detected by the java machine, it would be queued by japi. So, if you got missing events, the java runtime machine cannot detect them. This could happend if your computer is oberloaded by to many processes, or your computer is to slow. I have two machines: first an 166 MHz P1 and an 400MHz K2 both running Linux ;-)

Have Fun

Merten


#include
#include "japi.h"

int main()
{
int frame,fga_button,obj;
int fga=0;
char tbuf[256];

j_setdebug(0);

if(!j_start())
printf("can't connect to server\n"),exit(0);


frame = j_frame("Growing Button");
fga_button = j_button(frame,"increase");
j_setsize(fga_button,80,20);
j_setpos(fga_button,88,138);

j_setsize(frame,256,256);
j_show(frame);

while(1)
{
obj=j_nextaction();
if(obj==fga_button)
{
fga++;
sprintf(tbuf,"%d",fga);
j_settext(fga_button,tbuf);
}
if(obj ==frame)
break;

}
j_quit();

exit(0);
}

von Merten - am 05.08.2002 09:52
Ok, so I have played around a lot with this and found out a few things.

First, JAPI works and doesn't miss events. However, the installation and use of the JRE is not simple in some cases. I believe what caused my problem was referencing a Windows XP JRE through a Cygwin link while running under Windows 2000 (!). Seems like I read in another post that mixing Java stuff like that caused wierd problems--I agree.

I installed J2RE 1.4 and it works, but I haven't gotten my JAPI compiled application to automatically run--I have to start the JAPI server explicitly first with javaw -jar JAPI JAPI. How come? Is it because the runtime is no longer called jre and it isn't found? No error message is generated, the application simply doesn't do anything and terminates. I'm going to have to look at the Java website and figure out how to install all this stuff, particularly if I want to distribute software written with JAPI to naive users.

How do most go about distributing JAPI based software?

von Terry Brown - am 07.08.2002 15:23
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.