Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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  
  Focus problem  (Read 1352 times)
0 Members and 1 Guest are viewing this topic.
Offline Grand Poeba

Junior Devvie





« Posted 2006-01-21 23:54:03 »

Hey

As yo u may know i am working on a conversing of ttd but i am having thefollowing problem
When i let the user choose its resolution (by using a jdialog) before launching the game my jframe
doenst gain the focus when opening.
When i start my app without the jdialog first aeverything goes fine but when i use the jdialog before creating
the jframe it doens obtain the focus. Any ideas how this comes and to solve it?

thx
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2006-01-21 23:56:11 »

requestFocus()

弾幕 ☆ @mahonnaiseblog
Offline Grand Poeba

Junior Devvie





« Reply #2 - Posted 2006-01-22 00:37:49 »

requestFocus()

tried it but didnt help (i dont have to it when just using jframe)
even tried requestFocusInWindow
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #3 - Posted 2006-01-23 04:24:02 »

setFocusable(true); ?

Offline Mr_Light

Senior Devvie


Medals: 1


shiny.


« Reply #4 - Posted 2006-01-23 15:52:25 »

whats the JDialog's owner?

this is one of the few uses where one should use requestFocus() over requestFocusInWindow(), make sure that setVisible(true); is called,and executed before the requestFocus();

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline Grand Poeba

Junior Devvie





« Reply #5 - Posted 2006-01-23 17:07:46 »

whats the JDialog's owner?

this is one of the few uses where one should use requestFocus() over requestFocusInWindow(), make sure that setVisible(true); is called,and executed before the requestFocus();

the jdialog has no owner because its just appearing before the actual launch of the game. So no jframe has been created yet
Offline cylab

JGO Wizard


Medals: 89



« Reply #6 - Posted 2006-01-24 08:03:28 »

I think the only way to overcome this problem is by creating the frame first, show it with a placeholder panel inside, display the dialog with this frame as the owner and modify the existing frame after the dialog exits.

Mathias - I Know What [you] Did Last Summer!
Offline Jeff

JGO Coder




Got any cats?


« Reply #7 - Posted 2006-01-30 00:56:13 »

if requestFocus on the window doesnt work, try it on the window's content pane.

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.

 
bilznatch (17 views)
2015-08-04 11:03:17

SHC (38 views)
2015-08-01 03:58:20

Jesse (24 views)
2015-07-29 04:35:27

Riven (44 views)
2015-07-27 16:38:00

Riven (25 views)
2015-07-27 15:35:20

Riven (27 views)
2015-07-27 12:26:13

Riven (18 views)
2015-07-27 12:23:39

BurntPizza (40 views)
2015-07-25 00:14:37

BurntPizza (48 views)
2015-07-24 22:06:39

BurntPizza (33 views)
2015-07-24 06:06:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21
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!