Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
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  
  Focus problem  (Read 1173 times)
0 Members and 1 Guest are viewing this topic.
Offline Grand Poeba

Junior Member





« 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 Member





« 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 Member


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 Member





« 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 Ninja


Medals: 49



« 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.

 

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

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (20 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

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

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

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

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

Tekkerue (50 views)
2014-09-09 02:24:56
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!