Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (593)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
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 1335 times)
0 Members and 1 Guest are viewing this topic.
Offline Grand Poeba

Junior Devvie

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


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?

Offline oNyx

JGO Coder

Medals: 2

pixels! :x

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


弾幕 ☆ @mahonnaiseblog
Offline Grand Poeba

Junior Devvie

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


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


« 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: 85

« 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!
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

deepthought (36 views)
2015-06-30 15:39:44

deepthought (39 views)
2015-06-30 15:39:09

deepthought (52 views)
2015-06-30 15:36:52

Za\'Anzabar (21 views)
2015-06-29 05:44:54

TritonDreyja (39 views)
2015-06-24 17:10:40

CopyableCougar4 (35 views)
2015-06-23 00:34:45

BurntPizza (40 views)
2015-06-21 20:36:46

cookiecompiler (83 views)
2015-06-11 15:42:53

cookiecompiler (45 views)
2015-06-11 15:41:14

NegativeZero (75 views)
2015-06-11 09:49:18
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

Resources for WIP games
by kpars
2014-12-18 10:26:14 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‑
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!