Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  typing and mouse input don't both work  (Read 1078 times)
0 Members and 1 Guest are viewing this topic.
Offline musicalhearing

Innocent Bystander





« Posted 2007-03-13 15:26:00 »

In my Java game, I can't get the buttons to work consistently WITH the button clicks.  My program works fine on my MAC but doesn't work OK with Windows.  Any suggestions?
Offline fletchergames

Senior Member





« Reply #1 - Posted 2007-03-13 16:07:05 »

It's probably an issue with the keyboard focus.  Look up focus management in the Java Tutorial.

Basically, you need to make everything you can ignore the focus.  And then make the container components all add your KeyListener.  Or at least that's the normal thing to do - it might not be best for your particular program.
Offline Coinerson

Junior Member




Introducing the world's cutest zombie, Timmy


« Reply #2 - Posted 2007-03-13 21:28:58 »

Well, focus issues are usually fixed when you click In the window I think. My framework doesn't handle it properly either, but hte first screen you see uses desguised swing buttons so it gets focus when you click those Cheesy.

requestFocusInWindow() in your JFrame I think, again mine doesnt even work.
requestFocus() in your canvas type doodad

correct me if I am wrong...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2007-03-16 21:25:28 »

Or you could kick this whole focus issue in the nuts and use JInput.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (25 views)
2014-09-19 03:14:18

Dwinin (39 views)
2014-09-12 09:08:26

Norakomi (68 views)
2014-09-10 13:57:51

TehJavaDev (93 views)
2014-09-10 06:39:09

Tekkerue (47 views)
2014-09-09 02:24:56

mitcheeb (68 views)
2014-09-08 06:06:29

BurntPizza (51 views)
2014-09-07 01:13:42

Longarmx (38 views)
2014-09-07 01:12:14

Longarmx (44 views)
2014-09-07 01:11:22

Longarmx (40 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!