Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2007, 04:38 AM
Member
 
Join Date: Oct 2007
Posts: 7
Bibendum is on a distinguished road
Help with keyboard events?
I've been programming for a short while, and I just started learning java. Right now, I'm making a Galaga-like game, just to see if I could.

Here's a link to the source.

Everything is working fine, except for the keyboard events, and I have no idea what I'm doing wrong. Also, if I made any mistakes with the basic structure and such, help with that would be appreciated.

-Joe
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-30-2007, 06:16 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,022
hardwired is on a distinguished road
Code:
public SpaceGame(int width, int height){ ... addKeyListener(new MyKeyListener()); // Keyboard input requires the listening component to have the focus. setFocusable(true); new Thread(this).start(); ... public static void main(String [] args){ ... frame.add(g); // This should be last for proper/complete initialization. frame.setVisible(true);
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-02-2007, 03:51 AM
Member
 
Join Date: Oct 2007
Posts: 7
Bibendum is on a distinguished road
Thanks! This seems to have worked.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the Call events in J2ME krmlkr CLDC and MIDP 1 03-08-2008 10:39 AM
SWT Events JavaForums Java Blogs 0 12-31-2007 05:53 PM
Need Help With Button Events adlb1300 New To Java 5 11-03-2007 06:36 AM
To capture events with struts Ed Web Frameworks 2 07-04-2007 07:01 AM
Help, events in Jbutton class Heather Java Applets 2 06-30-2007 05:32 PM


All times are GMT +3. The time now is 11:14 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org