Java help -- Key Listeners

AlexWade

Member
Sep 27, 2003
89
0
0
First, this is NOT JavaScript or a Java Applet. This is a compilled, stand-alone running Java program.

The problem I have is I cannot find anything on KeyListeners for stand-alone programs. Oh, there is a ton of info for JavaScripts, but that is not what I'm doing.

Please, does anyone know how to get my stand-alone Java GUI program is respond to the keyboard.

Thank you.

Wade
 

AlexWade

Member
Sep 27, 2003
89
0
0
Those tutorials are for applets. I'm not doing applets. I'm make a .exe file and running it from the command prompt.
 

Kilrsat

Golden Member
Jul 16, 2001
1,072
0
0
Umm... dude, relax, the tutorial MrChad gave you will work. The difference between a java applet and a java application: Applet's start with public void init() and face a few security restrictions while applications start with public void main (String[] args)

Other than that, the support is the same, just look at how the listener was implemented in Sun's tutorial and recreate the work in your application. Its very easy. Although the fact that you're compiling to an exe makes me think you're using J++ as a development environment so you may face restrictions by default in what classes are available to you. In that case you need to include the .jar files from Sun in your classpath so you have access to the full Java feature set instead of the bastardized version from MS.

If you want more help you're going to have to explain exactly what your development environment is and give a few details on what your application is doing (like what needs to listen to key strokes), because right now no one can really offer better advice than the tutorial from Sun.
 

AlexWade

Member
Sep 27, 2003
89
0
0
Okay, thanks.

I'm not using a Microsoft compiller, but J2EE. I spent several days on the tutorial provided, to no avail. I'll just ask somewhere else.

 

PCHPlayer

Golden Member
Oct 9, 2001
1,053
0
0
Obviously Alex has no idea what he is talking about, nor is he willing to help us to help him.
Welcome to ATF Alex, better adjust the attitude a bit in future.