File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Detecting the location of Java Application on multiple screen computer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Detecting the location of Java Application on multiple screen computer" Watch "Detecting the location of Java Application on multiple screen computer" New topic
Author

Detecting the location of Java Application on multiple screen computer

Anand Kumar Reddy
Greenhorn

Joined: Jul 01, 2008
Posts: 6
Hi,

We are developing an application using Java Swing and most of the cases, this application will be accessed using JNLP links and Citrix Presentation Servers and
all the users will have multiple screens connected to their computers.

My problem is, I have to show some warning pop-up windows, alert pop-up windows etc at the center of the application. In case if the application is mostly hidden (like only the left edge of the application is visible and the rest is not shown on any screen), I have to show the pop-up on the relevant screen where the user can actually see it.

How can I detect on which screen/monitor my application is located? Ex. The application is located on screen number 4 and it is only partly visible. In this case, I have to show the pop-up at the center of screen 4. If the application is completely visible on screen 3, I have to show the pop-up at the center of the application window.
I have been trying to figure this out for a long time but not able to... .

Please help....
Thanks in advance for the perfect answer....


Cheers,
Anand.

Reach for the sky.. even if you have to stand on cactus!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19790
    
  20


The thing you have to ask yourself is this though: what if a window is positioned in two screens? On which one do you display it? The first you encounter, or the one that contains the largest part of the window?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Anand Kumar Reddy
Greenhorn

Joined: Jul 01, 2008
Posts: 6
Thanks Rob for the reply. I will try it rightaway.

And when the application window is positioned over two screens, I will still be showing the pop-up at the center of the application (even if the pop-up will be split over the two screens). I hope I will not have any problems showing it that way.. let me check. Thank you for the new test case ...
Anand Kumar Reddy
Greenhorn

Joined: Jul 01, 2008
Posts: 6
In addition to my initial question, I have one more question. If the application is being accessed via Citrix Presentation servers, will the call to :
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment() return the Graphics environment of the client machine or the citrix server?

Please advise. Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19790
    
  20

To be honest, I have no idea. Why don't you try it out? Give them different screen resolutions and check the results.
Anand Kumar Reddy
Greenhorn

Joined: Jul 01, 2008
Posts: 6
Thanks Rob, your advise worked. Now, only thing is I am not sure of the behaviour in Citrix. I will have to wait till the build goes to QA... Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Detecting the location of Java Application on multiple screen computer