f



Help, Help, Help...

Hei!

Im makin a hot INVADERS game with Java
but im a newbie with language, so , question is
how do i use KeyPressed () function...

I hav Applet Runnable... 


0
JariTapio (51)
3/25/2005 11:39:13 AM
comp.lang.java.help 13340 articles. 0 followers. Post Follow

5 Replies
2497 Views

Similar Articles

[PageSpeed] 31

-!Hei!-

Here is my problem...

public class TestinKeys extends Applet implements Runnable
....
....
    public void run ()
    {
         while ( true )
        {
            KeyEvent ke;
            if ( ke.getKeyChar() == 'a' ) g_TykkiX ++;
....
....

What is Wrong, im tryin to make that Invaders game but i dont know
how to read keyboard with Runnable Java code...



0
JariTapio (51)
3/25/2005 1:16:26 PM
JariTapio <JariTapio@pp.inet.fi> wrote:
> public class TestinKeys extends Applet implements Runnable
> ...
> ...
>     public void run ()
>     {
>          while ( true )
>         {
>             KeyEvent ke;
>             if ( ke.getKeyChar() == 'a' ) g_TykkiX ++;
> ...
> ...
> 
> What is Wrong, im tryin to make that Invaders game but i dont know
> how to read keyboard with Runnable Java code...

You've got some basic understanding of Java and GUI programming to worry 
about here.  Java does not provide the ability to "poll" the state of 
the keyboard.  Instead, you need to handle key-press events, and 
maintain your own keyboard state if desired.  Look at addKeyListener and 
the KeyAdapter class.

In any case (GUI or not), you can *never* just declare a reference 
variable as you do above, and then start calling methods of it as if it 
already pointed to an object.  You also don't want to create your own 
KeyEvent object.  If you did, the information you put in it would be 
fake; you could not really determine anything about the keyboard that 
way.  Instead, you need to implement KeyListener (or extend KeyAdapter), 
and handle your own auto-repeat.  The KeyEvent will be provided as a 
parameter to the keyPressed method.

-- 
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
0
cdsmith (3862)
3/25/2005 2:06:04 PM
Your applet must implement KeyListener. Therefore you will have to
implement the keyPressed, keyReleased and keyTyped methods. For
example:

public void keyPressed(KeyEvent e)
    {
	int code = e.getKeyCode();
	if (code == KeyEvent.VK_A) g_TykkiX ++;
    }

--
Fahd Shariff
http://www.fahdshariff.cjb.net
"Let the code do the talking... "

0
fahdshariff (129)
3/25/2005 6:12:46 PM
-!Hei!-

Yep, Still not workin i hav a similar code for Mouse and Keyboard...
Mouse is workin just fine...
Keyboard is not, it is not givin any results at all for a keystrokes...

Thank you again for helpin me...

//----

 addKeyListener ( new KeyAdapter()
    {
            public void KeyPressed ( KeyEvent ke )
            {
                g_TykkiX = 20;
            }
    });


     addMouseListener ( new MouseAdapter()
     {
            public void mousePressed ( MouseEvent me )
            {
                g_TykkiX = 20;
             }
      });

//----

JariTapio / Helsinki / Suomi / 2005.
www.EUROJARI.com
 


0
JariTapio (51)
3/26/2005 9:29:13 AM
Yep, Finally workin...

No need for help anymore...
Thank you for everyone... 


0
JariTapio (51)
3/27/2005 10:47:13 AM
Reply:

Similar Artilces:

Help Help Help Help Help
please,help us . we have a seious problem, we are designing a radio controlled car that is guided by the PC, to send the data wireless between the PC and the Car and vice versa. we use 2 transmitter/reciever circuits from 2 seperate radio controlled car each running with a different frequency (27 MHz & 40 MHz)and modify the functionality of each to do the disered work. but on mounting a transmitter(40MHz) and reciever(27MHz) on the car, and attach another transmitter(27MHz) and reciever(40MHz) to the PC; we found that on sending signals from the car to the PC on the transmitter & rec...

help!help!help!help!
I am a student.I am going to make a simulation of a robot (FANUC Robot M-16iB) under the matlab\simulink environment . It is a normal 6DOF robot.I want to realize any angle and any speed (under the max speed) and any position and orientation control. As I just starting to do this new field,I have no experience about it. Can you give me some simulation demo or examples for 6DOF robot? I am very eager to get these.Please write back to me as soon as possible,thank you! Sincerely, Connie&#12288;&#12288;&#12288;&#12288;&#12288;&#12288;&#12288; zhanglijuan920@sohu.c...

Help!! Help!! Help!!
I wish to vectorize the following code: s = tf('s'); W = logspace(-1,2,50); COMBINATION = combn(W, 2); K = cell(length(COMBINATION), 1); K0 = 1 + (1/(2*s)) + 0.5*s/(0.2*s + 1); % PID controller to be approximated as PI gapValue = zeros(length(COMBINATION), 1); for i = 1:length(COMBINATION) K{i} = (COMBINATION(i,1)*(1 + (1/(COMBINATION(i,2)*s)))); % PI controller end for i = 1:length(COMBINATION) gapValue(i,1) = gapmetric(K0, K{i}); end where K0 is the Nominal transfer function and K is a cell array including transfer functions whose gap metric from K0 are...

Help Help Help
Hello, I am a reluctant user of the website ntsearch.com. I accidentally download a Java program called "dict" from an ebook website to my XP and now every English words that I read from my computer has got a link with your web. I found it very frustrating when I noticed all the chinese characters I read from the web now become loads of question marks. I think it has a link with the program that I accidentally downloaded from that ebook website. How can I remove the so called "dict" program and other Java Scripts from my computer? This is very urgent and please answer my question as soon as you can. Thanks for your help. Regina Pun Select Add/Remove Programs from your Control Panel, find the programs = you want to delete and click the delete button. "Jerry Arzin" <h974483@graduate.hku.hk> wrote in message = news:33b5a863.0406112354.2679fd31@posting.google.com... > Hello, >=20 > I am a reluctant user of the website ntsearch.com. I accidentally > download a Java program called "dict" from an ebook website to my XP > and now every English words that I read from my computer has got a > link with your web. I found it very frustrating when I noticed all the > chinese characters I read from the web now become loads of question > marks. I think it has a link with the program that I accidentally > downloaded from that ebook website. How can I remove the so called > "dict" program and other Java...

help help help
I need to refresh my C knowledge quickly. I will be reading code for simple industrial type controls like motor controllers, valve drivers, etc This software is pretty simple, 3000 lines max. The executable is embedded in flash on the processor chip. Actually I haven't seen it yet. I haven't looked at C or done any programming in ages. I'm looking for a simple programming suite that will run on my WinXP (NTFS) computer. Something that doesn't take really long to get up to speed with. Simple is better. I just need to practice and remember and do some simple experi...

help! help!! help!!!
x=[0 1 10] p=[100 80] how can I get A A=[3x(1) 2x(1) x(1) 1 0 0 0 0; 2x(1) x(1) 1 0 0 0 0 0; 3x(2) 2x(2) x(2) 1 -3x(2) -2x(2) -x(2) -1; 2x(2) x(2) 1 0 -2x(2) -x(2) -1 0; p(1)x(1) p(1) 0 0 -p(2)x(2) -p(2) 0 0; p(1) 0 0 0 -p(2) 0 0 0; 0 0 0 0 -p(2)x(3) -p(2) 0 0; 0 0 0 0 -p(3) 0 0 0; ] In article <fkus3t$11h$1@fred.mathworks.com>, Jim lei <redlightlike@mathworks.com> wrote: >x=[0 1 10] >p=[100 80] >how can I get ...

help help help
Sir, Am Avinash.T.J doing my btech AMRITA ...

help! help!! help!!! me
hello if x=linspace(1,100,n); p=linspace(100,80,n-1); how can I get A A=[ x(1) 1 0 0 0 0 0 0...0 0; x(2) 1 -x(2) -1 0 0 0 0...0 0; p(1) 0 -p(2) 0 0 0 0 0...0 0; 0 0 x(3) 1 -x(3) -1 0 0...0 0; 0 0 p(2) 0 -p(3) 0 0 0...0 0; 0 0 0 0 x(4) 1 -x(4) -1...0 0; 0 0 0 0 p(3) 0 -p(4) 0...0 0; ....................................... 0 0 0 0 0 0...x(i) 1 -x(i) -1...0 0; 0 0 0 0 0 0...p(i-1) 0 -p(i-1) 0 ...0 0; ......................................... 0 0 0 0 0 0....x(n-1) 1 -x(n-1) -1; 0 0 0 0 0 0....p(n-2) 0 -p(n-1) 0; 0 0 0 0 0 0.... 0 0 p(n-1) 0; ] "Jim lei" <redlightlike@mathworks.c...

Help Help Help
Hello, I am a reluctant user of the website ntsearch.com. I accidentally download a Java program called "dict" from an ebook website to my XP and now every English words that I read from my computer has got a link with your web. I found it very frustrating when I noticed all the chinese characters I read from the web now become loads of question marks. I think it has a link with the program that I accidentally downloaded from that ebook website. How can I remove the so called "dict" program and other Java Scripts from my computer? This is very urgent and please answer my ...

Help Help Help
Q1 I want to know how to show the 8 bit planes of the image?? Q2 And also find edges of image by showing both edge magnitude and direction?? ...

HELP HELP HELP...
Hi everybody there. I have created a GUI in MATLAB's guide application. In the GUI I am appearing on the screen a frame from a camera by pushing a button. My problem that sometimes the application works fine, but some others something is going wrong and I get the following error message: ??? Assignment has more non-singleton rhs dimensions than non-singleton subscripts Error in ==> LEDsFinal>txtGrabFrame_Callback at 164 A(width, i, Blue) = abs(fread(portCMU, 1, 'uint8'))/255; What does the error message mean? What seems to be the problem? How can I overco...

Help, Help, Help
As you can probably gather im in need of help. I started a basic JAVA course a week ago as it seems like a very interesting subject. The problem in having is with the IDE we have been asked to use. We are using JCreator, but in order for it to work, we are required to install the Java software development kit and a class library which comes with the course book called avi with is a audio visual interface library which is supposed to make it easier for us to learn the fundimentals of JAVA without having to worry about the input/output. Anyways, I have installed the JAVA SDK from SUN website...

HELP HELP HELP
Hi! All, I am an Interactive Media Designer and know very less about asp but the basic concept behind. I got to make an online test(Exam) in asp which has a login (frm access database) panel. Can any one direct me to a free source so that I can simply pick the project and customize it. Thnaks in Advance Raj.Design In article <1112007306.454441.207430@f14g2000cwb.googlegroups.com>, raj.design@gmail.com enlightened us with... > Hi! All, > I am an Interactive Media Designer and know very less about asp but the > basic concept behind. I got to make an online te...

Help! Help! Help!
My daughter has a Dell 2300 that is coincidentally 1 month past the warranty. It will start up and shut off within 1 minute. It doesn't matter if I boot from hard drive, floppy, go into safe mode, or go to setup screen. I don't know how to try to isolate the problem. (Mother board, power supply etc.) Any suggestions? sogs wrote: > My daughter has a Dell 2300 that is coincidentally 1 month past the > warranty. It will start up and shut off within 1 minute. It doesn't > matter if I boot from hard drive, floppy, go into safe mode, or go to > setup screen....

HELP-HELP-HELP!!!!!!!!!!
On this site par example: http://communications.siemens.com/cds/frontdoor/0,2241,nl_nl_0_27443_rArNrNrNrN,00.html u have a 3d animation, like many other sites...but if i want to see this a new window opens and i see a icon with ared cross in it. also on sites with games i see this... What is my problem? I have winXP-Pro firewall is out and sec. is on low..... twan1@home.nl (Twan) writes: > On this site par example: > http://communications.siemens.com/cds/frontdoor/0,2241,nl_nl_0_27443_rArNrNrNrN,00.html > u have a 3d animation, like many other sites...but if i want to...

help help help
hi all im new to linux can anyone tell me the best place to get some help installing programs in linux or best books to read -- --------------------------------- --- -- - Posted with NewsLeecher v3.7 Final Web @ http://www.newsleecher.com/?usenet ------------------- ----- ---- -- - peteware wrote: > hi all im new to linux can anyone tell me the best place to get some > help installing programs in linux or best books to read > > > -- > --------------------------------- --- -- - > Posted with NewsLeecher v3.7 Final > Web @ http://www.newsleecher.com/?usenet > -...

HELP! HELP! HELP!
We are currently running R83 v3.1m (33 user) on an old 200 Mhz Pentium with 16Mb Mem and 2.x gif HD (the actual partition is smaller) We have run this for a number of years without ANY significant problems. Last week (just as my family was in the middle of "the move from Hell") the system decides to take a major dump. A bad link of some sort in the ABS area. THEN - the systems disks have disappeared. After much screaming and gnashing of teeth I got the system running again. OH! did I mention that the previous evenings file save tape was bad? Anyhow, the bottom line is that I REALLY need a set of 33 user 3.1m disks. Any Ideas/Help? I do have a 25 user version of r83 v3.1 (no 'm') with a monolith loader diskette (5.25) but it doesn't seem to hook up with the PICK diskettes (just keeps rebooting) If I can get a sister machine running with the 25 user - does anyone have any trick to bump it to 33 user. There must be just a byte or 2 in the ABS area that regulates # of users. Again - Help! Help! Help! Van PS: The reason we haven't upgraded is that I am using a 4GL called Envision that was written a long time ago and about half of it was done in assembler and won't run on any of the later version of PICK. I've been meaning to re-write it in Basic but it's a pretty daunting project. I'd get busy rewriting the software if I were you. If anyone actually has the disks, there's ...

HELP! HELP! HELP
I hope someone out there can solve my mysterious problem. I have tried everything imaginable, even paid $35 to Microsoft to help me, but they were not able to figure out this problem: Here is the problem: I recently created a new database in Access 2002. I took data from an > access 97 database converted one of the tables to access 2002 and then > imported it into a new table in access 2002. but for some strange > reason, every once in a while the data changes to Japanese characters, > it only happens once in a while, but once it happens that record is > lost. i have tried...

HELP HELP HELP
Hello everyone, I am a freshmen at a computer university and also new to C++ . I havent used C before either but been through PASCAL and GW-BASIC. Can someone please tell me the link to download the C++ compiler which can run on my Windows XP Professional Edition. Thanks. ByE. Yours forever in Digital Paradise uSmAn could have typed what u wanted in google. "Usman" <game_pk@hotmail.com> wrote in message news:buobgo$kaacm$1@ID-217624.news.uni-berlin.de... > Hello everyone, > I am a freshmen at a computer university and also new to C++ . I havent used > C before eit...

Help Help Help
Hello, I am a reluctant user of the website ntsearch.com. I accidentally download a Java program called "dict" from an ebook website to my XP and now every English words that I read from my computer has got a link with your web. I found it very frustrating when I noticed all the chinese characters I read from the web now become loads of question marks. I think it has a link with the program that I accidentally downloaded from that ebook website. How can I remove the so called "dict" program and other Java Scripts from my computer? This is very urgent and please answer my ...

Help Help Help
Hi everybody there... I want to develop an application that uses GUIDE and will have two windows figures(figure1 and figure2). In figure1 the user will write down in a text box a string. Then figure1 closes, load figure2 and use that string. Finally, I would like to ask how can I use mouse click event. I would really appreciate any help of you. Thank you in advance.. NM Hi, see examples in the documentation : http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/exampleindex.html J�r�me On Mar 14, 12:38 pm, nm <nmihaili...@gmail.com> wrote: > Hi everybody ther...

Re: HELP HELP HELP!!!
Hi Elena and everyone requesting help, Everyone on SAS-L either requests or provides help, so a subject line like HELP is completely meaningless. And so is a subject like SIMPLE NEWBIE QUESTION; first of all a newbie would not be able to decide the question to be simple (and whether a question or problem is simple or not does not matter at all), secondly questions are mostly posed by newbies (and being a newbie does not help getting a question answered more quickly) and thirdly it concerns questions which are being asked (that is trivial, but which question?). Other examples of nonsense subje...

help help help ASAP
Hi Guys I need some1 to help me to code the inequality below % Data Parameters n = 5; x = 1.*ones(n,1); y = 4.*ones(n,1); z = 3.*ones(n,1); lambda = [20;30;25;45;35]; % I wrote Code for the function F(r) for each i % Decision Vriable L L is a vector for i = 1 : n that minimze the Inequality (x_i + y_i) * (sum F_i(r_i) , r_i = 0 : L_i) - z_i*lambda_i*F_i(L_i) > = x_i for each i so i need to write code for the inequality to obtain L for each i that minimizes the Inequality thank you Adel On 8/27/2011 10:58 PM, ADEL wrote: .... > so i n...

help! help!! help!!! me #2
if d^4y/dx^4+d^2y/dx^2=0 y(0)=0,d^y(0)=0,d^2y(15)=100,d^3y(15)=80 how can I get y "Jim lei" <redlightlike@mathworks.com> wrote in message <fluj43$ii8$1@fred.mathworks.com>... > if d^4y/dx^4+d^2y/dx^2=0 > y(0)=0,d^y(0)=0,d^2y(15)=100,d^3y(15)=80 > > how can I get y You don't say at what value of x you wish to know y. So I'll assume that you need y at x = 0. y = 0 HTH, John (By the way, you might get better responses if you used a descriptive subject line.) On Jan 7, 8:20=A0pm, "Jim lei" <redlightl...@mathworks.com> wrote: > ...

Web resources about - Help, Help, Help... - comp.lang.java.help

Help - Wikipedia, the free encyclopedia
United States Senate Committee on Health, Education, Labor and Pensions , commonly abbreviated "H.E.L.P." Text is available under the Creative ...

Help:Contents - Wikipedia, the free encyclopedia
Templates are special pages that contain boilerplate text intended to be displayed on more than one page in Wikipedia. This Tip of the day box ...

Google’s Destinations Helps Users Plan Trips Through Google Search
Google has introduced a new Destinations feature within Google search on mobile, allowing users to plan their next vacation within Google’s search ...

The Obama administration steps in to help develop smart cities
... smart city projects with federal grants. The enormous economic potential of IoT solutions should give the federal government reason to help ...

Could Sarah Paulson’s drunken meetup with Marcia Clark help win her an Emmy?
Sarah Paulson recently admitted that she did research for her role as Marcia Clarke in The People vs. O.J. Simpson by getting drunk with the ...

Cat Helps Break Her Dog Friend out of "Prison"
Submitted by: (via Erica Borrowdale ) Tagged: dogs , Cats , Video Share on Facebook

Do people think you're a jerk? Peeple may help you find out
When people heard about the app that helps you review people on the Internet, they panned it as a terrible idea. Now it's been released.

Lee helps Halak get 200th win; Islanders beat Penguins 2-1
NEW YORK (AP) — Anders Lee scored the tiebreaking goal in the third period, Jaroslav Halak stopped 31 shots before leaving late in the third ...

Coachella helps festival-goers prep for the desert with VR
VR has become a key marketing tool, especially when it comes to big events. When Coachella attendees receive this year's Welcome Box containing ...

Kim Kardashian Joins Snapchat With the Help of Sister Kourtney
Kim Kardashian Joins Snapchat With the Help of Sister Kourtney

Resources last updated: 3/9/2016 9:09:25 PM