Get Location Of Application Window?

Good day all.  Unfortunately, my first post here must be a question … I was hoping that wouldn't be the case :slight_smile:



Anyway, I have been searching (perhaps in vain) for a way to determine the location (x,y) of the application window.  I am using the Standard Game framework (multi-thread ftw) in case that matters.



Thank you all in advance.



-Ben

Welcome to jME :slight_smile:


I am using the Standard Game framework (multi-thread ftw)

http://www.jmonkeyengine.com/jmeforum/index.php?topic=7250.0

Anyway, I have been searching (perhaps in vain) for a way to determine the location (x,y) of the application window.

You could create a JMEDesktop which gives you access to X and Y values of the app. Check out the example classes packed with JME. But im not sure if that's what you're after though.
Could you be a bit more specific in what kind of way you want to use it?

Thanks for the reply.



I'm basically trying to figure out where to pop up a dialog.  I suppose if I were able to get at the root awt window object that might work too, but I'm guessing that doesn't have a good position data for the dialog to use to center itself.



Ideally, I would just use an internal frame and make it modal, but I am porting over a game that used to use plain old Java 2d rendering, and lots of swing.  I've been able to integrate all the other UI components, except he dialogs.  Ideally, I want to be as lazy as possible :slight_smile:



The dialogs currently work, but the location they choose to pop up has no real relevance to the game, and that kind of looks icky.  I want them to pop up in the middle of the window, like a good app dialog should.

Why don't you actually load them in the game then?  That also resolves the modality issue and fullscreen.

I suppose I could do that, but that requires abstracting out the whole dialog event.  The controller is directly kicking it off, and I could simply pull that into the view interface.  The Java2d would pop up a JDialog, and the jME view would create a modal internal frame.  I was just hoping to be lazy, and find out how to create popups for non-fullscreen games.



While no one has said so explicitly, it certainly sounds like there is no way to get a handle on the native windows location … seems strange, but I suppose non-fullscreen is in the minority.



A-refactoring I go :slight_smile:

What this ever changed? I'd like to set the position of my JME window, but I don't know how to access the underlying window.